1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Sub compteurCouleursCellules()
Dim Cell As Range
Feuil2.Range("A1:A10").Clear
'recherche dans la plage A1:A10 de la Feuil1
'Le résultat s'affiche dans la Feuil2
For Each Cell In Feuil1.Range("A1:A10")
Select Case Cell.Interior.ColorIndex
'sans couleur
Case xlNone: Feuil2.Cells(1, 1) = Feuil2.Cells(1, 1) + 1
'orange
Case 46: Feuil2.Cells(2, 1) = Feuil2.Cells(2, 1) + 1
'vert
Case 10: Feuil2.Cells(3, 1) = Feuil2.Cells(3, 1) + 1
'rouge
Case 3: Feuil2.Cells(4, 1) = Feuil2.Cells(4, 1) + 1
End Select
Next Cell
Feuil2.Cells(1, 1).Interior.ColorIndex = xlNone
Feuil2.Cells(2, 1).Interior.ColorIndex = 46
Feuil2.Cells(3, 1).Interior.ColorIndex = 10
Feuil2.Cells(4, 1).Interior.ColorIndex = 3
End Sub |
Partager