gavinkelly
Board Regular
- Joined
- Jan 12, 2008
- Messages
- 220
I have having trouble with error handling:
The first error is ignored as it goes to ErrorHandler and so resumes the loop but the next time there is an error in the loop the code stops i.e. it does not go to ErrorHandler. I guess this is to do with errors in loops.
any suggestions to make the error always got to the handler?
Code:
On Error GoTo ErrorHandler
For y = 2 To 25
For x = 2 To 9
i = WorksheetFunction.Find(Cells(x, 4), Cells(y, 1), 1)
Cells(y, 2) = Cells(x, 5)
Exit For
ErrorHandler:
Next x
Next y
The first error is ignored as it goes to ErrorHandler and so resumes the loop but the next time there is an error in the loop the code stops i.e. it does not go to ErrorHandler. I guess this is to do with errors in loops.
any suggestions to make the error always got to the handler?