G
Guest
Hi, I am using the IsError function nested in an If statement to try and get
the macro to skip over some steps if the search comes up empty. I pass the
search variable (Acct) from a function based on the number of the loop
(counter). Works fine if the search has a positive result, but gets an
object error if search is negative. Here is the code:
Do Until Counter > 38
ACCTNAME (Counter) ' passes Acct name back to sub
Columns("B:B").Select
If IsError(Selection.Find(What:=Acct, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate) Then
'skip
Else.......
Any help will be appreciated.
Thanks
Marc
the macro to skip over some steps if the search comes up empty. I pass the
search variable (Acct) from a function based on the number of the loop
(counter). Works fine if the search has a positive result, but gets an
object error if search is negative. Here is the code:
Do Until Counter > 38
ACCTNAME (Counter) ' passes Acct name back to sub
Columns("B:B").Select
If IsError(Selection.Find(What:=Acct, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate) Then
'skip
Else.......
Any help will be appreciated.
Thanks
Marc