A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Links and Linking
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

delete rows



 
 
Thread Tools Display Modes
  #1  
Old December 1st, 2004, 09:56 PM
dd
external usenet poster
 
Posts: n/a
Default 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  
Old December 1st, 2004, 11:33 PM
Bill Manville
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 05:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.