I am trying to remove all cells in my spreadsheet that have the word TOTAL in them. My current VBA code:
Sub Delete_Rows()
Dim RNG As Range, cell As Range, del As Range
Set RNG = Intersect(Range("A1:A5000"), ActiveSheet.UsedRange)
For Each cell In RNG
If (cell.Value) = "TOTAL" _
Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.Delete
End Sub
This isn’t working, and I can’t understand why. Sorry I am being so vague, but clearly something obvious is eluding me.
Thanks
Based upon what we discussed above, here’s what you’re looking for: