![]() |
Delete Rows - include top row
Using xl2000. In a range of approx 12000 rows, I am deleting rows that match
17 different criteria. Is there an easy way to include the first row? The main code is a variation on one of Chip Pearson's posts and runs from the bottom of the range and works upwards using: Range([a1], [a65536].End(xlUp)).Select ColNum = Selection(1).Column For RowNdx = Selection( _ Selection.Cells.Count).Row To _ Selection(1).Row + 1 Step -1 'Times before 07:40 If Cells(RowNdx, ColNum).Offset(0, 1).Value < 0.319444 Then Cells(RowNdx, ColNum).EntireRow.Delete End If Next RowNdx i.e., for the above code, if B1 contains, say, 06:30, the above code does all the rest, but not the first row. Should I just include a "control row" at the top or is there a better way? Martin |
Delete Rows - include top row
|
Delete Rows - include top row
For RowNdx = Cells(Rows.Count,"A").End(xlUp).Row To 1 Step -1
'Times before 07:40 If Cells(RowNdx, "A").Offset(0, 1).Value < 0.319444 Then Cells(RowNdx, "A").EntireRow.Delete End If Next RowNdx -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "TiscaliNews" wrote in message ... Using xl2000. In a range of approx 12000 rows, I am deleting rows that match 17 different criteria. Is there an easy way to include the first row? The main code is a variation on one of Chip Pearson's posts and runs from the bottom of the range and works upwards using: Range([a1], [a65536].End(xlUp)).Select ColNum = Selection(1).Column For RowNdx = Selection( _ Selection.Cells.Count).Row To _ Selection(1).Row + 1 Step -1 'Times before 07:40 If Cells(RowNdx, ColNum).Offset(0, 1).Value < 0.319444 Then Cells(RowNdx, ColNum).EntireRow.Delete End If Next RowNdx i.e., for the above code, if B1 contains, say, 06:30, the above code does all the rest, but not the first row. Should I just include a "control row" at the top or is there a better way? Martin |
Delete Rows - include top row
Don and Bob,
Thank you gentlemen, problem solved. Martin |
All times are GMT +1. The time now is 05:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com