By: Shamima Sultana

In reply to T C Millichap.

Hello T C Millichap,

It sounds like the macro might not be checking all rows properly when there are consecutive zeros. This could happen if the loop skips over rows after deleting one. You can modify the code to ensure it doesn’t skip rows by adjusting how the loop is set up.

Sub DeleteRow_DefinedRange()
Dim Rng As Range
Dim i As Long

For i = 14 To 5 Step -1 ' Loop backwards to prevent skipping rows
If Cells(i, 4).Value = 0 Then
Rows(i).Delete
End If
Next i
End Sub

By looping backwards, you prevent skipping rows after deletion. This should address the issue of consecutive zeros. Let me know if you need further adjustments!

Regards
ExcelDemy