79168165

Date: 2024-11-07 21:50:55
Score: 1
Natty:
Report link

Instead of using the variable for the loop (r), create a your own variable to track your position and update.

lastr = Range("a2").End(xlDown).Row
CurrentPosition = 2
For r = 2 To lastr
    If Cells(CurrentPosition, 1).Value <> "SHORT POSITIONS" And Cells(CurrentPosition, 7).Value = 0 And Cells(CurrentPosition,10).Value <> "Yes" Then
        Rows(CurrentPosition).Delete
        CurrentPosition = CurrentPosition - 1
    End If
    CurrentPosition = CurrentPosition + 1
Next r
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: William Rivas