Greetings, I have the following macro used to delete rows with 0 in column E. However, this macro is assuming there is a header row and there is none. Can someone please tell me how to tweak it so it will include the header row? Thanks a bunch.
Sub DeleteRows()
Application.ScreenUpdating = False
Dim e As Range, rng
Range("e65536").End(xlUp).Select
lastrow = Selection.Row
Set rng = Range("E1:e" & lastrow)
For Each e In rng
If e.Value = 0 Then
e.Offset(0, 1).Value = "Delete"
End If
Next e
With Range(Range("f1"), Range("f" & Rows.Count).End(xlUp))
.AutoFilter Field:=1, Criteria1:="Delete"
.Offset(1).EntireRow.Delete
.AutoFilter
End With
Application.ScreenUpdating = True
End Sub
Sub DeleteRows()
Application.ScreenUpdating = False
Dim e As Range, rng
Range("e65536").End(xlUp).Select
lastrow = Selection.Row
Set rng = Range("E1:e" & lastrow)
For Each e In rng
If e.Value = 0 Then
e.Offset(0, 1).Value = "Delete"
End If
Next e
With Range(Range("f1"), Range("f" & Rows.Count).End(xlUp))
.AutoFilter Field:=1, Criteria1:="Delete"
.Offset(1).EntireRow.Delete
.AutoFilter
End With
Application.ScreenUpdating = True
End Sub