Prevent first row to be deleted

RonEmm

Board Regular
Joined
Aug 18, 2009
Messages
108
Hi,

This is part of my code:
Code:
        .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown)).AutoFilter Field:=1, _
            Criteria1:="xxxx"
        .Cells.SpecialCells(xlCellTypeVisible).EntireRow.Delete
This code will also delete the first row (header) in my sheet. Is there a way to exclude the first row and prevent it form being deleted?
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,573
Office Version
2010
Platform
Windows
Hi,

This is part of my code:
Code:
        .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown)).AutoFilter Field:=1, _
            Criteria1:="xxxx"
        .Cells.SpecialCells(xlCellTypeVisible).EntireRow.Delete
This code will also delete the first row (header) in my sheet. Is there a way to exclude the first row and prevent it form being deleted?
Maybe this in place of what you posted...
Code:
With .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
  .AutoFilter Field:=1, Criteria1:="xxxx"
   .SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
 
Last edited:

Forum statistics

Threads
1,085,895
Messages
5,386,630
Members
402,009
Latest member
dcouto

Some videos you may like

This Week's Hot Topics

Top