View Single Post
 
Old 03-19-2017, 01:31 PM
ewso ewso is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Nov 2016
Posts: 80
ewso is on a distinguished road
Default

Quote:
Originally Posted by NoSparks View Post
What you've pointed out in post #8 pretty much contradicts that, but here you go
Code:
Sub RowDoesNotContain()

Dim x As Long, ContainWord As String

'What phrase do you want to test for?
  ContainWord = "Magic"

With Sheets("Sheet1")    '<~~~ change as necessary
    For x = .Cells(Rows.Count, "A").End(xlUp).Row To 1 Step -1
        If Not Rows(x).Find(ContainWord) Is Nothing Then Rows(x).Delete
    Next x
End With

End Sub
thanks nosparks, but this is removing the rows that contain the specified text instead of removing the rows which do not contain the specified text.

edit: i removed the word 'Not' in the code and now it works fine.

thanks logit and nosparks.