ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Row if Value in Column L equals zero (https://www.excelbanter.com/excel-programming/401822-delete-row-if-value-column-l-equals-zero.html)

Aaron

Delete Row if Value in Column L equals zero
 
Hello,

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

Thanks in advance

Luc[_3_]

Delete Row if Value in Column L equals zero
 
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



sharmashanu

Delete Row if Value in Column L equals zero
 
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


Aaron

Delete Row if Value in Column L equals zero
 
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




All times are GMT +1. The time now is 06:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com