ChuckDrago
Active Member
- Joined
- Sep 7, 2007
- Messages
- 470
- Office Version
- 2010
- Platform
- Windows
Hi all,
I have a macro that loops through a list of items, locates them on another sheet via a FIND method and collects some data pertaining to the found item. It works well, except that it stops when the item is not found. To handle this, I used an On Error Resume Next statement, so that the item not found is skipped. And therein lies the issue... The Resume Next portion is not resuming.
The error code thrown is 91. The error setting in my computer is Break on unhandled errors. The macro stops via the End Sub below the inoperative Resume Next. Here is the related code:
and the Go To section is simply
The idea was to set the flag "Trap", so that the item not found is ignored and the loop moves to the next item (named CurID).
Any help will be appreciated as usual.
Chuck
I have a macro that loops through a list of items, locates them on another sheet via a FIND method and collects some data pertaining to the found item. It works well, except that it stops when the item is not found. To handle this, I used an On Error Resume Next statement, so that the item not found is skipped. And therein lies the issue... The Resume Next portion is not resuming.
The error code thrown is 91. The error setting in my computer is Break on unhandled errors. The macro stops via the End Sub below the inoperative Resume Next. Here is the related code:
Code:
Range("A:A").Select
On Error GoTo NotListed
Selection.Find(What:=CurID, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
If Trap <> "Yes" Then...etc ,etc
and the Go To section is simply
Code:
NotListed:
Trap = "Yes"
On Error Resume Next
End Sub
The idea was to set the flag "Trap", so that the item not found is ignored and the loop moves to the next item (named CurID).
Any help will be appreciated as usual.
Chuck
Last edited: