I have created this code but its erroring out when i have a sheet with the same name, even though i have an error handler. Maybe someone can help us just modify this a lil bit and it should work for you.
Sub check_code()
Dim SheetName As String
Dim ws As Worksheet
On Error GoTo Errhandler
Fname = ActiveWorkbook.Name
Workbooks.Add
MName = ActiveWorkbook.Name
For i = 1 To Workbooks(Fname).Worksheets("Sheet1").Range("A2").End(xlToRight).Column Step 2
For j = 3 To Workbooks(Fname).Worksheets("Sheet1").Cells(3, i).End(xlDown).Row
resume_sheet:
Workbooks(Fname).Worksheets(1).Activate
SheetName = Workbooks(Fname).Worksheets("Sheet1").Cells(j, i).Text
For Each ws In Workbooks(MName).Worksheets
If SheetName = "" Or ws.Name = SheetName Then
j = j + 1
GoTo stopcode
Else
Workbooks(Fname).Worksheets("Invoice_Sheet").Copy before:=Workbooks(MName).Sheets(1)
If ws.Name = SheetName Then
GoTo Errhandler
Else
Workbooks(MName).Worksheets("Invoice_Sheet").Name = SheetName
'GoTo stopcode
End If
End If
'Next
Next
stopcode:
Next
Next
Errhandler:
MsgBox Err.Description
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
GoTo resume_sheet
End Sub
Bookmarks