Delete Filtered Rows - without deleting column headings

D

Denise

I have the following code that filters the rows that I
want to delete, however it also deletes the column
headings. How do I change it to preserve the headings?
Thanks in advance for your help.

' Find the rows that do not have a D or a Z in column C
' and delete them. Cells with D are orders rows, cells
' with Z are Sales Doc rows.
Columns("C:C").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>Z*",
Operator:=xlAnd, _
Criteria2:="<>D*"
Cells.SpecialCells(xlCellTypeVisible).EntireRow.Delete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top