This explains it
![]()
Public Sub Test() Dim eRange As Range Dim Bool As Boolean Dim NotFound As Boolean Dim i As Long Bool = True NotFound = False With Sheet1 For i = 1 To .Rows.Count If InStr(1, .Cells(i, "A").Value, "@") > 2 Then If Bool = True Then Bool = False Set eRange = Rows(i) NotFound = True Else Set eRange = Union(eRange, Rows(i)) NotFound = True End If End If Next i If NotFound = True Then eRange.EntireRow.Delete Else MsgBox "No e-mail found." End If End With End Sub
Bookmarks