mscallisto
Technical User
Code:
' Delete all rows after the last light blue in col 5
' Rows are sorted by col 5 color
For intPtr = 2 To intLastRow - 1 ' Skip Header Row
If Rows(intPtr).Columns(5).Interior.ColorIndex <> "20" Then
Rows(intPtr & ":" & intLastRow).Delete xlUp
Exit For
End If
Next intPtr
intLastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
[\code]
The above code works fine, it deleted all remaining rows after the last light blue in col 5
I expected the variable intLastRow to be recalculated after the deletes, but it retained it's orig value.
Why is this?
I temporarily fixed the problem with:
intLastRow = intPrt -1