johnbird1988
Board Regular
- Joined
- Oct 6, 2009
- Messages
- 199
This piece of VBA code is looping through a range of around 200 rows but for some reason it keeps looping even after all rows have been addressed. I’m not sure if the reason it is looping so much is because of the part highlighted. Can someone explain what “Last To 1 Step -1” does and how I can get this to only loop through a range of circa 200 rows?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o> </o>
<o></o>
<o> </o>
Last = Cells(Rows.Count, "AC").End(xlUp).Row<o></o>
For i = Last To 1 Step -1<o></o>
If (Cells(i, "AC").Value) = "N" Then<o></o>
Cells(i, "A").EntireRow.Delete<o></o>
End If<o></o>
Next i<o></o>
<o> </o>
Last = Cells(Rows.Count, "AB").End(xlUp).Row<o></o>
For i = Last To 1 Step -1<o></o>
If (Cells(i, "AB").Value) = "Yes" Then<o></o>
Cells(i, "A").EntireRow.Delete<o></o>
End If<o></o>
Next i<o></o>
Thank you
<o> </o>
<o></o>
<o> </o>
Last = Cells(Rows.Count, "AC").End(xlUp).Row<o></o>
For i = Last To 1 Step -1<o></o>
If (Cells(i, "AC").Value) = "N" Then<o></o>
Cells(i, "A").EntireRow.Delete<o></o>
End If<o></o>
Next i<o></o>
<o> </o>
Last = Cells(Rows.Count, "AB").End(xlUp).Row<o></o>
For i = Last To 1 Step -1<o></o>
If (Cells(i, "AB").Value) = "Yes" Then<o></o>
Cells(i, "A").EntireRow.Delete<o></o>
End If<o></o>
Next i<o></o>
Thank you