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

Hello,

I have this code and it works perfectly for me (see code below). I want to
simplify it so it dosent ask me for which column to delete "0" from. This
column is always J in my worksheet. Can't figure it out though, whats the
right code?

Thanks...

Sub deletezeros()

colabel = InputBox("column label to delete zeros (ex. A, B, C...)")
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default deleting "0" rows

Sub deletezeros()

colabel = 10
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,
Tom Ogilvy


"steven" wrote:

Hello,

I have this code and it works perfectly for me (see code below). I want to
simplify it so it dosent ask me for which column to delete "0" from. This
column is always J in my worksheet. Can't figure it out though, whats the
right code?

Thanks...

Sub deletezeros()

colabel = InputBox("column label to delete zeros (ex. A, B, C...)")
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default deleting "0" rows

change
colabel = InputBox("column label to delete zeros (ex. A, B, C...)")

to
colabel = worksheet.columns("j")

(not sure if syntax is right.............untested).
susan


On Feb 20, 11:29 am, steven wrote:
Hello,

I have this code and it works perfectly for me (see code below). I want to
simplify it so it dosent ask me for which column to delete "0" from. This
column is always J in my worksheet. Can't figure it out though, whats the
right code?

Thanks...

Sub deletezeros()
colabel = InputBox("column label to delete zeros (ex. A, B, C...)")
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default deleting "0" rows

Sub deletezeros()

lrow = Cells(Rows.Count, "J").End(xlUp).Row
For i = lrow To 1 Step -1
If Cells(i, "J").Value = 0 Then Rows(i).Delete
Next i

End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"steven" wrote in message
...
Hello,

I have this code and it works perfectly for me (see code below). I want to
simplify it so it dosent ask me for which column to delete "0" from. This
column is always J in my worksheet. Can't figure it out though, whats the
right code?

Thanks...

Sub deletezeros()

colabel = InputBox("column label to delete zeros (ex. A, B, C...)")
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



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
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Deleting groups of continuous rows where col K = "x" Max Excel Programming 6 February 18th 06 11:21 PM
Deleting "duplicate" rows mmednick Excel Discussion (Misc queries) 7 January 11th 06 08:22 PM
Deleting Rows with Sum of "0" in 4 columns mike meyer Excel Programming 7 September 12th 05 06:26 PM


All times are GMT +1. The time now is 06:10 AM.

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"