If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
delete rows
i would like to run a macro that does the following.
start at row 2 if L2 and m2 and n2 are all zeros then delete row if not then go to next row and do the same check. the macro should end once the "L" field is blank. let me know if more info is need thanks -- |
#2
|
|||
|
|||
Dd wrote:
i would like to run a macro that does the following. start at row 2 It's easier to start at the end and work back. Sub DeleteRows() Dim lRow as Long lRow = ActiveSheet.UsedRange.SpecialCells(xlLastCell).Row Do Until lRow = 1 If Cells(lRow, "L")=0 And Cells(lRow, "M")=0 And Cells(lRow, "N")=0 Then Rows(lRow).Delete End If lRow = lRow-1 Loop End Sub An alternative would be to use AutoFilter and delete all the visible rows. Bill Manville MVP - Microsoft Excel, Oxford, England No email replies please - respond to newsgroup |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Here's a shocker | Mike Labosh | General Discussion | 2 | October 26th, 2004 05:04 PM |
Delete Rows | kkondrat1 | General Discussion | 3 | September 29th, 2004 09:25 PM |
Delete rows in Excel file with formulas | Krassimir | Setting up and Configuration | 1 | October 1st, 2003 03:17 AM |
How to delete hidden rows | Fox JW | Worksheet Functions | 1 | September 25th, 2003 07:03 PM |