Hi all,
I have a macro that performs filtering and deleting unwanted rows.
I find it strange that it is now not working when it was working few days ago.
It's giving me a runtime error 91.
Here's my code:
Sub Testing()
Dim Cl As Range
Dim rng As Range
Dim R As Long
Dim X As Long
R = ActiveSheet.Cells(Rows.Count, "K").End(xlUp).Row
For X = 2 To R
If Cells(X, "K").Value <> "AB," And Cells(X, "K").Value <> "CD," And _
Cells(X, "K").Value <> "EF," And Cells(X, "K").Value <> "IJ," And Cells(X, "K").Value <> "TU," Then
If rng Is Nothing Then
Set rng = Cells(X, "K")
Else: Set rng = Union(rng, Cells(X, "K"))
End If
End If
Next X
rng.EntireRow.Delete
End Sub
Any ideas? Appreciate any help. Thank you.
Bookmarks