test sur mise en forme conditionnelle

G

GO

Guest
Salut à tous

Un crack saurait il me dire comment il serait possible de tester le résultats d'un mise en forme conditionnelle, par exemple si la mise en forme conditionelle met une couleur rouge à une note inférieur à 10 et que je souhaite faire la somme de ces notes avec une macro

Merci

(les propriété de FormatCondition étant très limité, mais il doit bien y avoir une astuce...)
 
R

rudy

Guest
bonsoir ,Go et le forum

Utilise cette macro :

Sub ElleEstBelleMaMEFC()
'Laurent Longre, MPFE, correction 2003
Dim FC As FormatCondition, F1, F2
Dim C As Range
Set C = Cells.Find(Empty)
Application.ScreenUpdating = False
For Each FC In ActiveCell.FormatConditions
C.FormulaLocal = FC.Formula1: F1 = C
If FC.Type = xlCellValue Then
Select Case FC.Operator
Case xlBetween, xlNotBetween:
C.FormulaLocal = FC.Formula2: F2 = C
If FC.Operator = xlBetween Then If ActiveCell >= F1 _
And ActiveCell <= F2 Then Exit For
If ActiveCell < F1 _
Or ActiveCell > F2 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 xlNotEqual: If ActiveCell <> F1 Then Exit For
End Select
Else
If F1 Then Exit For
End If
Next FC
If Not FC Is Nothing Then MsgBox FC.Interior.ColorIndex _
Else MsgBox ActiveCell.Interior.ColorIndex
C.Clear

End Sub
@+ Rudy
PS s'il y a un probleme envoies pour te corriger .
 

Statistiques des forums

Discussions
312 193
Messages
2 086 062
Membres
103 110
dernier inscrit
Privé