PC Review


Reply
Thread Tools Rate Thread

deleting "0" rows

 
 
=?Utf-8?B?c3RldmVu?=
Guest
Posts: n/a
 
      20th Feb 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      20th Feb 2007
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

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      20th Feb 2007
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 <ste...@discussions.microsoft.com> 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



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      20th Feb 2007
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" <(E-Mail Removed)> wrote in message
news:85B73360-85F7-4126-8742-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting rows when cell has "#DIV/0!" error mattg Microsoft Excel Programming 2 19th Apr 2010 07:42 PM
Deleting rows when cell text reads "Research" iashorty Microsoft Excel Programming 2 7th Nov 2008 07:07 PM
Deleting groups of continuous rows where col K = "x" Max Microsoft Excel Programming 6 18th Feb 2006 11:21 PM
Re: Deleting Rows with Sum of "0" in 4 columns Tom Ogilvy Microsoft Excel Programming 2 12th Sep 2005 06:07 PM
Resetting "End" "Home" After Deleting Rows =?Utf-8?B?RG91Zw==?= Microsoft Excel Worksheet Functions 1 24th Mar 2004 10:06 PM


Features
 

Advertising
 

Newsgroups
 


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