Attribute VB_Name = "createSheets" Sub CreateSheetIfNotExist() Dim cellValue As String Dim sheetNames As Variant Dim i As Long Dim ws As Worksheet Dim sheetExists As Boolean ' Articles seperated by a , cellValue = ThisWorkbook.Sheets("Setup Data").Range("B24").Value ' Split the comma-separated string into an array of sheet names sheetNames = Split(cellValue, ",") Debug.Print "Value in the cell: " & cellValue ' Split the comma-separated string into an array of sheet names sheetNames = Split(cellValue, ",") Debug.Print "Result of Split function:" For i = LBound(sheetNames) To UBound(sheetNames) Debug.Print " Index " & i & ": """ & sheetNames(i) & """" Next i ' Loop through each potential sheet name For i = LBound(sheetNames) To UBound(sheetNames) Dim newSheetName As String newSheetName = Trim(sheetNames(i)) ' Remove any leading/trailing spaces sheetExists = False ' Check if the sheet already exists For Each ws In ThisWorkbook.Sheets If ws.Name = newSheetName Then sheetExists = True Exit For End If Next ws ' If the sheet doesn't exist, create it If Not sheetExists Then On Error Resume Next ' In case there's an issue creating the sheet ThisWorkbook.Sheets.Add After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count) ActiveSheet.Name = newSheetName On Error GoTo 0 ' Resume normal error handling Debug.Print "Sheet '" & newSheetName & "' created." Else Debug.Print "Sheet '" & newSheetName & "' already exists." End If Next i End Sub