ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete rows with header, excluding 1st row (https://www.excelbanter.com/excel-programming/441171-delete-rows-header-excluding-1st-row.html)

J.W. Aldridge

delete rows with header, excluding 1st row
 
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).


Chip Pearson

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).



All times are GMT +1. The time now is 02:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com