I am subtotaling data, copying that data to another worksheet, then filtering for a column and deleting those rows.
The problem is that the range of the data to delete will vary every time the macro is run.
Here's an example of what I have:
Range("A2").Select
Columns("A:C").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(3), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Range("A2:C2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Range("$A$1:$C$396").AutoFilter Field:=2, Criteria1:="<>"
Rows("2:394").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$1:$C$42").AutoFilter Field:=2
Range("A22").Select
Selection.End(xlDown).Select
Rows("42:42").Select
Selection.Delete Shift:=xlUp