Public Sub GetNextColoredRow()
Dim RowIndex, ColIndex, LastRow, LastCol As Integer
Dim Cell As Variant
' get the used range
LastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
LastCol = Cells.SpecialCells(xlCellTypeLastCell).Column
For RowIndex = ActiveCell.Row + 1 To LastRow
For ColIndex = 1 To LastCol
Set Cell = Cells(RowIndex, ColIndex)
' -4142 means white
If Cell.Interior.ColorIndex <> -4142 Then
Debug.Print "Color: " & Cell.Interior.ColorIndex
Cell.Select
Exit Sub
End If
Next ColIndex
Next RowIndex
End Sub
No comments:
Post a Comment