Hi,
You should look to use the Selection.Find method to perform your search.... this code should do the search and find all TOURS in the list but it doesn't do anything else.
'select the whole range to search, in this case column A Columns("A:A").Select 'the tour found, stored as a range Dim FoundTour As Range
'do an inital search and find the first tour in column A Set FoundTour = Selection.Find(What:="TOUR", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) 'if tour was found then If Not FoundTour Is Nothing Then 'store it's address which is used to determine if the search has been completed Dim firstAddress As String firstAddress = FoundTour.Address Do 'find the next tour after the current found tour Set FoundTour = Selection.FindNext(FoundTour)
'continue the search until tour is no longer found or until the search reaches the starting address 'of the first found tour Loop While Not FoundTour Is Nothing And FoundTour.Address <> firstAddress End If
www.dsmyth.net/blog |