how to detect whether VBA excel found something?

Dim rng As Range

Set rng = Selection.Find(What:=email, After:=ActiveCell, LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False)

If Not rng Is Nothing Then 'when rng <> nothing means found something'
    rng.Activate
End IF

Leave a Comment