View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Placing the MsgBox "No ID found" statement in my code??

On Monday, May 5, 2014 10:30:02 PM UTC-7, GS wrote:
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



That worked well.

Thanks, Garry