I recorded a macro to prepare/format and clean up an exported set of data. This data set changes is size (number of rows) each month I run the report and export the data. I believe my macro to remove the Grand Totals and Salesperson Total contained in the raw data of the spreadsheet deletes specific row numbers (276:276 and 624:634). I want to delete the rows that appear in the filter criteria regardless of their row number. The following is the current VBA code:
ActiveSheet.Range("$A$3:$G$821").AutoFilter Field:=1, Criteria1:= _
"Grand Total"
ActiveWindow.SmallScroll Down:=-9
Rows("276:276").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$3:$G$820").AutoFilter Field:=1, Criteria1:= _
"Salesperson Total"
Rows("624:634").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$3:$G$809").AutoFilter Field:=1
End Sub
ActiveSheet.Range("$A$3:$G$821").AutoFilter Field:=1, Criteria1:= _
"Grand Total"
ActiveWindow.SmallScroll Down:=-9
Rows("276:276").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$3:$G$820").AutoFilter Field:=1, Criteria1:= _
"Salesperson Total"
Rows("624:634").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$3:$G$809").AutoFilter Field:=1
End Sub