Just in case you come back this way, I thought I'd demonstrate what I meant in my comment. It's true that the Macro Recorder creates a literal array of all the values that contain "Total." Your generated code looked something like this, I'll bet:
Sub Macro1()
ActiveSheet.Range("$B$3:$B$29").AutoFilter Field:=1, _
Criteria1:=Array("Boston Total", "Chicago Total", "December Total", "February Total", _
"January Total", "January Total Total", "November Total", "October Total", _
"October Total Total", "San Francisco Total"), Operator:=xlFilterValues
Rows("16:29").Select
Selection.ClearContents
End Sub
The trick is to replace that array of values with a single value that uses wildcards, i.e., "*Total*"
. Combining that with your LastRow
and other variables, I come up with:
Sub DeleteTotals()
Dim LastRow As Long
Dim r As Excel.Range
With ActiveSheet
LastRow = .Range("B" & .Rows.Count).End(xlUp).Row
Set r = .Range(Cells(4, "B"), Cells(LastRow, "B"))
End With
With r
.AutoFilter Field:=1, Criteria1:="*Total*", Operator:=xlFilterValues
.SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
End Sub
This kind of code is faster than looping. It may not matter if you don't have much data, but it's good to know you can do it this way.