Sub DerniereCelluleColoree()
Dim c As Range
Dim cnt As Long, iCell As Long
With Range("B3:BU22")
cnt = .Count
For iCell = cnt To 1 Step -1
Debug.Print .Cells(iCell).Address
If .Cells(iCell).Interior.ColorIndex <> xlColorIndexNone Then
MsgBox .Cells(iCell).Address
Exit Sub
End If
Next
End With
End Sub
est chose différente que la dernière cellule colorée d'une plage.la cellulle la plus à droite colorée
Sub DerniereCelluleColoree()
Dim iCol As Long
Dim cnt As Long, iCell As Long
With Range("B3:BU22")
For iCol = .Columns.Count To 1 Step -1
For iCell = .Columns(iCol).Cells.Count To 1 Step -1
If .Cells(iCell, iCol).Interior.ColorIndex <> xlColorIndexNone Then
MsgBox .Cells(iCell, iCol).Address
Exit Sub
End If
Next
Next
End With
End Sub