PC Review


Reply
Thread Tools Rate Thread

Delete Row if Value in Column L equals zero

 
 
Aaron
Guest
Posts: n/a
 
      28th Nov 2007
Hello,

I am looks for code that will delete the entire row if the value in column L
is zero.

Thanks in advance
 
Reply With Quote
 
 
 
 
Luc
Guest
Posts: n/a
 
      28th Nov 2007
lastrow = Cells(Rows.count, "A").End(xlUp).Row

Set myrange = Range("L1:L" & lastrow)
For Each count In myrange
If count.Value = "0" Then
count.EntireRow.Delete
End If
Next


 
Reply With Quote
 
sharmashanu
Guest
Posts: n/a
 
      28th Nov 2007
HI Aron

Use the following code

Sub test()
Dim i, j As Integer


Set starta = ActiveSheet.Range("L1")
LR = ActiveSheet.Range("L" & Rows.Count).End(xlUp).Offset(1, 0).Row

For i = LR To 0 Step -1
If starta.Offset(i, 0).Value = 0 Then starta.Offset(i,
0).EntireRow.Delete
Next i


End Sub

Thanks

Shanu

 
Reply With Quote
 
Aaron
Guest
Posts: n/a
 
      28th Nov 2007
This work great! Thanks!

"sharmashanu" wrote:

> HI Aron
>
> Use the following code
>
> Sub test()
> Dim i, j As Integer
>
>
> Set starta = ActiveSheet.Range("L1")
> LR = ActiveSheet.Range("L" & Rows.Count).End(xlUp).Offset(1, 0).Row
>
> For i = LR To 0 Step -1
> If starta.Offset(i, 0).Value = 0 Then starta.Offset(i,
> 0).EntireRow.Delete
> Next i
>
>
> End Sub
>
> Thanks
>
> Shanu
>
>

 
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
Keep lines when one column equals certain criteria Donna Microsoft Excel Worksheet Functions 2 23rd Apr 2010 01:16 AM
If cell equals a name then get data from column JDB Microsoft Excel Worksheet Functions 2 25th Sep 2008 12:15 AM
countif column d equals x and column a noblank Willie Wilson Microsoft Excel Worksheet Functions 4 5th Jan 2008 10:22 PM
Delete Columns if value equals zero Freddy Microsoft Excel Programming 2 28th Nov 2007 11:41 AM
How to sum items from column A only if Column B row equals X BM Microsoft Excel Worksheet Functions 1 17th Sep 2005 05:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:08 PM.