I am trying to find all cells on the page under the active cell containing "day"
For example, if I have
holiday
holiday
Monday
Tuesday
And the second holiday is selected, I would want to find Monday and Tuesday. However, it finds Monday, Tuesday and then holiday and then holiday and then repeats! I thought thats what "after:= ActiveCell" was for!
Sub Button1_Click()
Dim c As Range
Do While 1
Set c = Cells.Find("day", after:=ActiveCell, MatchCase:=True)
MsgBox c
If c Is Nothing Then
GoTo endofloop
Else
c.Activate
End If
Loop
endofloop:
End Sub
Thoughts?
Also is there a better way to break out of the loop than goto!?
Dave
Bookmarks