Richard,
I am not exactly sure how you have this set up, but two things come to mind. You could use an error handler like the one below. The On Error GoTo can go pretty much anywhere within your subroutine and the Exit Sub stuff goes right before the End Sub statement (at least that is how I have it set up).
On Error GoTo ErrorHandler
Exit Sub ' Exit to avoid handler.
ErrorHandler: ' Error-handling routine.
'Your code goes here
Resume 40 'Tell where the program should start up again
or
I have to search on an ID and I handle it this way
Set rEFC = wsEFC.Cells.Find(what:=ssn, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not rEFC Is Nothing Then
'If ssn is found do the code placed here
Else
'If ssn is not found do the code placed here
End If
Using the two examples above, you could code for your msgbox or whatever in the error handler or the else part of the if statement.
Maybe this will give you some ideas
Bookmarks