kevin440red
New Member
- Joined
- May 23, 2011
- Messages
- 26
- Office Version
- 2019
I found this bit of code to remove rows if it contains specific text. It runs slow on 8000 lines, would like to add more than 1 text "Dog,Cat,Chickens".
would like it to be lighting fast
Thanks
would like it to be lighting fast
Thanks
VBA Code:
Sub DeleteRowWithContents()
'========================================================================
' DELETES ALL ROWS FROM A2 DOWNWARDS WITH THE WORDs "[COLOR=rgb(235, 107, 86)]Dog,Cat,Chickens" IN COLUMN B
'========================================================================
Last = Cells(Rows.Count, "B").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "B").Value) = "Dog" Then
'Cells(i, "A").EntireRow.ClearContents ' USE THIS TO CLEAR CONTENTS BUT NOT DELETE ROW
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub