I am looping through rows of a table and deleting rows if certain conditions are not met. For some reason my for loop never exits even when its done. What am I doing wrong?
lastr = Range("a2").End(xlDown).Row
For r = 2 To lastr
If Cells(r, 1).Value <> "SHORT POSITIONS" And Cells(r, 7).Value = 0 And Cells(r, 10).Value <> "Yes" Then
Rows(r).Delete
r = r - 1
lastr = lastr - 1
End If
Next r
For r = lastr to 2 step -1. This way, you don't have to bother withr = r-1andlastr = lastr -1? lastrin the immediate window...