xls 2013 - delete rows if a cell does not contain any of a list of multiple values

Joined
Sep 20, 2013
Messages
1
Reaction score
0
Hi, I am new here so please excuse any faux pax on my part. I was browsing the web and found a post here on how to delete rows in xls that did not contain a certain word in a specific column. Works great!

I need to specify about 12 different possible words that I want to retain, and delete all rows where the cell does not contain any of those 12 possible words. I tried an or and an elseif statement, but xls did not like it.

Can anyone point me to how to look for a list of words?

The posting for one value was:

Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If InStr(Cells(row_index, "B").Value,"SEOP")=0 then
Cells(row_index, "B").EntireRow.delete
End If
Next
Application.ScreenUpdating = True
End Sub

Thank you!
ann13sch
 
Back
Top