Delete row macro

E

Esrei

I need to delete a row in a spreadsheet if the value in
the last cell of the row is 0. With a macro
 
F

Frank Kabel

Hi
try the following macro:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "Z").End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, "Z").Value= 0 then
Rows(row_index).delete
End If
Next
Application.ScreenUpdating = True
End Sub
 
Top