Delete from the bottom up :-)
For Cnt = 505 to 1 step -1
You might need to adjust your logic ... maybe, step -5
Regards
Delete from the bottom up :-)
For Cnt = 505 to 1 step -1
You might need to adjust your logic ... maybe, step -5
Regards
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Excellent, thank you. I didn't realize you could do that, maybe VB isn't so horrible after all.
For anyone who is interested, this is the working code. (I hate googling & finding these posts with no solution posted at the end.)
![]()
Sub Change() Dim Row As Integer Dim DeleteFlag As Integer DeleteFlag = 1 For Row = 505 To 1 Step -1 bgrange = "A" & Row & ":BB" & Row If DeleteFlag > 5 Then DeleteFlag = 1 End If If DeleteFlag = 4 Or DeleteFlag = 5 Then DeleteFlag = DeleteFlag + 1 Else DeleteFlag = DeleteFlag + 1 'Cells(Row, 2).Value = DeleteFlag 'Range(bgrange).Interior.Color = RGB(255, 0, 0) Range("A" & Row).EntireRow.Delete End If Next End Sub
Last edited by mtfd; 01-13-2011 at 11:25 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks