删除整行时如何添加多个条件?

我已经search,我没有find正确的答案或创build我的代码没有运气:

此代码将删除Col D中包含“apple”的整个行。

我将如何在strSearch中添加条件? 我想添加“香蕉”和“猫”?

Sub Delete_EntireRow_Values() ' ' Delete_EntireRow_Values Macro Dim rFind As Range Dim rDelete As Range Dim strSearch As String Dim sFirstAddress As String strSearch = "apple" Set rDelete = Nothing Application.ScreenUpdating = False With Sheet1.Columns("D:D") Set rFind = .Find(strSearch, LookIn:=xlValues, LookAt:=xlPart, SearchDirection:=xlNext, MatchCase:=False) If Not rFind Is Nothing Then sFirstAddress = rFind.Address Do If rDelete Is Nothing Then Set rDelete = rFind Else Set rDelete = Application.Union(rDelete, rFind) End If Set rFind = .FindNext(rFind) Loop While Not rFind Is Nothing And rFind.Address <> sFirstAddress rDelete.EntireRow.Delete End If End With Application.ScreenUpdating = True End Sub 

更有效的方法是使用自动筛选器并传递一组单词来删除

 Sub DeleteMatchingCriteria() Application.ScreenUpdating = False Dim toDelete As Variant ' set the words to delete toDelete = Array("apple", "cat", "bannana") Dim colD As Range Set col = Sheet1.Range("D1:D" & Sheet1.Range("D" & Rows.Count).End(xlUp).Row) With col .AutoFilter Field:=1, Criteria1:=toDelete, Operator:=xlFilterValues .Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete End With Sheet1.AutoFilterMode = False End Sub