View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default delete rows with header, excluding 1st row

try code like the following:

Sub AAA()
Dim N As Long
With ActiveSheet
N = .Cells(.Rows.Count, "A").End(xlUp).Row
Do Until N = 1
If StrComp(.Cells(N, "A"), "DAY", vbTextCompare) = 0 Then
.Rows(N).Delete
End If
N = N - 1
Loop
End With
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Tue, 30 Mar 2010 10:25:28 -0700 (PDT), "J.W. Aldridge"
wrote:

Headers are repeated several times between rows A1:A1000.
Need to delete all rows where header "DAY" is in column A, except for
the first instance (A1).