View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Placing the MsgBox "No ID found" statement in my code??

Use a boolean 'flag' to let your code know whether an ID was found or
not...

Dim bFoundID As Boolean

...and add it to the part of code that finds an ID...

...<snip
If Not Rng Is Nothing Then
bFoundID = True: MsgBox Rng.Address & " " & ws.Name
End If

...and just check its value...

...<snip
Next ws
If Not bFoundID Then MsgBox "Not found"
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion