Ok, I think I understand what you are trying to do. You are trying to scan
each cell in Col.A in Sheet("ERRORS"), which is your "source". And within
each cell is a sheet name. You want to find that sheet within the workbook
and then paste that cells entire row in the sheet that was found. If the
sheet is not in the workbook, you want to create a new sheet before
Sheets("TA_END") and copy that cells row to it. Am I right?
If so, I took the liberty to rewrite your code. I wouldn't recommend you
using On Error Resume Next because it can cause a lot of problems when trying
to debug code. I tested this code and it worked for me. Hope this helps!
If so, let me know, click "YES" below.
Option Explicit
Sub Create_Sheets_From_Data()
Dim LastRow As Long
Dim rngSource As Range
Dim rng As Range
Dim wks As Worksheet
Dim bolSheetExists As Boolean
Application.ScreenUpdating = False
' set range of cells to loop thru in source worksheet
With Sheets("ERRORS")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Set rngSource = .Range("A1:A" & LastRow)
End With
' loop thru each cell in Source range
For Each rng In rngSource
' test if worksheet exists
For Each wks In Sheets
If rng.Value = wks.Name Then
bolSheetExists = True
Exit For
End If
Next wks
If bolSheetExists Then
' if sheet exists find lastrow and copy rng source row
LastRow = wks.Cells(Rows.Count, "A").End(xlUp).Row
rng.EntireRow.Copy Destination:=wks.Range("A" & LastRow + 1)
Else
' if sheet doesn't exist, create sheet and copy rng source row
Worksheets.Add(Before:=Sheets("TA_END")).Name = rng.Value
rng.EntireRow.Copy Destination:=Sheets(rng.Value).Range("A1")
End If
bolSheetExists = False
Next rng
Application.ScreenUpdating = True
End Sub