Delete rows if they don't contain multiple specific text

Mux99

New Member
Joined
Apr 15, 2019
Messages
25
I would like to delete all rows that don't contain multiple specific text in column D. The below code works great for two options but I have a list of twelve words that I would like to add.

Sub Del_Rows()
With Range("A1", Range("D" & Rows.Count).End(xlUp))
.AutoFilter Field:=4, Criteria1:="*apple*", Operator:=xlOr, Criteria2:="orange"
.EntireRow.Delete
.AutoFilter
End With
End Sub
Thanks in advance
 
Last edited:

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,093

Watch MrExcel Video

Forum statistics

Threads
1,095,726
Messages
5,446,152
Members
405,386
Latest member
xcookiemonster64

This Week's Hot Topics

Top