View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 44
Default Loop macro help.

Hope this helps

Tom


Sub Find()
Dim r As Range
Dim strAddress As String

Set r = ActiveSheet.Cells.Find("Hello")
If Not r Is Nothing Then
strAddress = r.Address
Do
MsgBox r.Address

Set r = Cells.FindNext(r)
Loop While Not r Is Nothing And r.Address < strAddress
End If
End Sub






"Pete" schrieb im Newsbeitrag
...
I have a MAcro that uses a the find ~Find function~. My
problem is when the macro can not find the word any
further it crashes instead of exiting the loop. I assume
(And we all know what that stands for)it is because of the
Microsoft error message of no matches were found. How can
I bypass this to exit the loop and continue on?

Any help is well recieved.
Pete W