I\'m trying to cycle through a table in excel. The first three columns of this table have text headings, the rest of them have dates as headings. I want to assign those date
Clearing all property settings of the Err object is not the same as resetting the error handler.
Try this:
Sub TestErr()
Dim i As Integer
Dim x As Double
On Error GoTo NextLoop
For i = 1 To 2
10: x = i / 0
NextLoop:
If Err <> 0 Then
Err.Clear
Debug.Print "Cleared i=" & i
End If
Next
End Sub
You'll notice the just like the OP, it will catch the error properly when i =1
but it will fail on line 10 when i = 2
, even though we used Err.Clear