nrdz83
XLDnaute Impliqué
Bonsoir à tous dans le fichier ci joint j'ai essayé d'adapter le code mfc à mon classeur j'y suis pratiquement arrivé sauf pour la couleur de la cellule C.
Voila je cherche a mettre en couleur verte la cellule C si la cellule B est inférieure ou egal à aujourdhui.
et si supèrieure à la cellule B alors en rouge.
D'avance merci à tpous pour votre aide.
Cijoint.fr - Service gratuit de dépôt de fichiers
le code
Voila je cherche a mettre en couleur verte la cellule C si la cellule B est inférieure ou egal à aujourdhui.
et si supèrieure à la cellule B alors en rouge.
D'avance merci à tpous pour votre aide.
Cijoint.fr - Service gratuit de dépôt de fichiers
le code
Code:
Sub mfc()
With Range(Cells(DerLig, 1), Cells(DerLig, 6))
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=ET(" & Cells(DerLig, 1).Address & "<>"""";MOD(LIGNE();2))"
With .FormatConditions(1).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.FormatConditions(1).Interior.ColorIndex = 35
.FormatConditions.Add Type:=xlExpression, Formula1:="=" & Cells(DerLig, 1).Address & "<>"""""
With .FormatConditions(2).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
With Cells(DerLig, 3)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=ET(" & Cells(DerLig, 1).Address & "<>"""";" & Cells(DerLig, 3).Address & "<AUJOURDHUI())"
With .FormatConditions(1).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.FormatConditions(1).Interior.ColorIndex = 3
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=ET(" & Cells(DerLig, 1).Address & "<>"""";" & Cells(DerLig, 3).Address & "<=AUJOURDHUI()+30)"
With .FormatConditions(2).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.FormatConditions(2).Interior.ColorIndex = 6
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=ET(" & Cells(DerLig, 1).Address & "<>"""";" & Cells(DerLig, 3).Address & ">AUJOURDHUI()+30)"
With .FormatConditions(3).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.FormatConditions(3).Interior.ColorIndex = 4
End With
End Sub