Compter les cellules ayant un format conditionnel
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 subAuteur : Alain Vallon
Mots clefs associés à cette page : cellule, condition, format
- Vous devez vous identifier ou créer un compte pour écrire des commentaires
