Delete Row if Value in Column L equals zero

A

Aaron

Hello,

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

Thanks in advance
 
L

Luc

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
 
S

sharmashanu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top