Compter les cellules ayant un format conditionnel

Je souhaiterais compter le nombre de cellules rouges sachant que cette couleur est appliquée par une mise en forme conditionnelle. (je ne veux pas compter le nombre de cellules répondant à la condition !)

sub Format_Conditionnel()
 Dim FC As FormatCondition, F1, F2
 For Each FC In ActiveCell.FormatConditions
  If FC.Type = xlCellValue Then
   F1 = Evaluate(FC.Formula1)
   Select Case FC.Operator
    Case xlBetween: If ActiveCell >= F1 _
     And ActiveCell <= Evaluate(FC.Formula2) Then Exit For
    Case xlEqual: If ActiveCell = F1 Then Exit For
    Case xlGreater: If ActiveCell > F1 Then Exit For
    Case xlGreaterEqual: If ActiveCell >= F1 Then Exit For
    Case xlLess: If ActiveCell < F1 Then Exit For
    Case xlLessEqual: If ActiveCell <= F1 Then Exit For
    Case xlNotBetween: If ActiveCell < F1 _
     Or ActiveCell > Evaluate(FC.Formula2) Then Exit For
    Case xlNotEqual: If ActiveCell <> F1 Then Exit For
   End Select
 Else
  If Evaluate(FC.Formula1) Then Exit For
 End If
 Next FC
  If Not FC Is Nothing Then
  MsgBox FC.Font.ColorIndex _
  Else MsgBox ActiveCell.Font.ColorIndex
  End If
 end sub

Auteur :

Mots clefs associés à cette page : , ,