AutoFit including first row which does not match filter. How to correct?

New Contributor


Running Excel 2013.  Have created a large vba macro to "edit" a worksheet.


ActiveSheet.Range("A1:A" & lastRow).AutoFilter Field:=1, Criteria1:="=#*", VisibleDropDown:=False

To filter so I can delete rows that have a part number starting with #.   The issue is that when the filter is applied, it includes the first row which does not have a part number starting with #.  I am sure that I am not understanding some aspect of the AutoFilter.  Can someone point out what I missed ?

Example of problem:

After applying Autofilter, I will get






part1 should not be shown.



1 Reply


AutoFilter always treats the first row of the range as a header row, so that row will never be filtered.