Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Macro that deletes rows with "0" value cells

Hi,

I have several worksheets with data. I'd like to specify a column and
wherever there is a 0 value in that column, the macro will delete the whole
row it is in. The column to look for the 0 in is different in each of my
worksheets so somehow i have to specify which one it is to the macro
beforhand.

any help aprecciated,

Steven.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 145
Default Macro that deletes rows with "0" value cells

Try this

Sub m()
colabel = InputBox("column label ?")
lrow = Cells(Rows.Count, colabel).End(xlUp).Row
For i = lrow To 1 Step -1
If Cells(i, colabel) = 0 Then Rows(i).Delete
Next i
End Sub

--
Regards

"steven" wrote in message
...
Hi,

I have several worksheets with data. I'd like to specify a column and
wherever there is a 0 value in that column, the macro will delete the

whole
row it is in. The column to look for the 0 in is different in each of my
worksheets so somehow i have to specify which one it is to the macro
beforhand.

any help aprecciated,

Steven.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
What is a function in VBA EXCEL witch finds a string like "not" in cell and then deletes a row with this cell? [email protected] Excel Programming 7 November 14th 05 09:13 AM
What is a function in VBA EXCEL witch finds a string like "not" in cell and then deletes a row with this cell? [email protected] Excel Worksheet Functions 3 November 14th 05 01:48 AM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 10:51 PM.

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

About Us

"It's about Microsoft Excel"