Hi
I have On Error "GoTo ErrorHandler" in my code
It works fine in first loop and Goes to ErrorHandler on error but in second loop of 'heads' it gives error as follows.
"vba object variable or with block variable not set"
For I = 28 To WS_Count
With Worksheets(I)
Sheet_Name = .Name
Name_Start = Left(Sheet_Name, 1)
Entries = Application.WorksheetFunction.CountA(.Range("D:E"))
Filled = Application.WorksheetFunction.CountA(.Range("F:F"))
If IsNumeric(Name_Start) And Sheets(I).Visible = True And Entries - Filled = 1 Then
.Activate
On Error GoTo ErrorHandler
For heads = 1 To 5
entry = Sheets("Analyzer").Range("C" & 30 + heads).Value
TargetSheet = Sheets("Analyzer").Range("B" & 30 + heads).Value
Error Line>>> EntryRwFirst = .Columns(6).Find(What:=entry, LookAt:=xlWhole, SearchDirection:=xlNext, MatchCase:=False).Row
'(irrelevant code removed)
ErrorHandler:
Next heads
End If
On Error GoTo 0
End With
Next I
Note: Error is happening because in both of 1st and 2nd loop the value is not found from the sheet. That is Ok but I want the code to go to ErrorHandler: when there is error in 2nd loop, instead of showing the error.
Thanks
Bookmarks