I'm trying to write a vba that will delete a row based on the criteria of two columns. In this case if the value of the two columns is zero (or null) or the value is an error, I want the row to be deleted. I tried the following code, but nothing seemed to happen. Your help is greatly appreciated.
Sub cleanup()
Dim i As Long
Dim LastRow As Long
LastRow = 10
Sheets("AX").Select
For i = LastRow To 3 Step -1
If (Range("e" & i).Value = 0 And Range("f" & i).Value = 0) Or IsError(Range("e" & i).Value) Then
Rows(i).EntireRow.Delete
End If
Next i
End Sub
Bookmarks