Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim matchRange As Range, firstMatchRange As Range
- Set matchRange = ws.columns(COLUMN_TO_SEARCH_IN).Find( _
- What:=VALUE_TO_SEARCH_BY, LookIn:=xlValues, LookAt:=xlWhole, _
- SearchOrder:=xlByRows, MatchByte:=False)
- ' Don't forget that the match will be the cell only, you will need
- ' to get the entire row from that for usual processing.
- ' Check if there's a match at all
- If Not matchRange Is Nothing Then
- ' Memorize first match to be able to recognize whether we've got
- ' back to start
- Set firstMatchRange = matchRange
- Do
- ' ... DO PROCESSING ON THE MATCH...
- ' ...and jump to the next one
- Set matchRange = _
- ws.columns(COLUMN_TO_SEARCH_IN).FindNext(matchRange)
- Loop While Not matchRange Is Nothing And _
- matchRange.Address <> firstMatchRange.Address
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement