Bonjour à tous
J'essaie de mettre en vba 3 mises en formes conditionnelles, mais ça bloque, pour les 2 premières il me met bien les formules dans les conditions, mais ça met "pas de mise en forme conditionnelle", la couleur est en place uniquement sur la 3ème mise en forme. (voir screenshot)
Voila la formule :
Merci d'avance
J'essaie de mettre en vba 3 mises en formes conditionnelles, mais ça bloque, pour les 2 premières il me met bien les formules dans les conditions, mais ça met "pas de mise en forme conditionnelle", la couleur est en place uniquement sur la 3ème mise en forme. (voir screenshot)
Voila la formule :
Code:
Sub valid()
AdrCellule_2 = ActiveCell.Address(False, True)
col = Left(ActiveCell.Address(ColumnAbsolute:=False), (ActiveCell.Column < 27) + 2)
moment = Cells(12, col).Value
If moment = "m" Then
col2 = col
Else
col2 = col - 1
End If
txt = col2 & "10"
txt2 = col2 & "9"
Selection.FormatConditions.Delete
'*******************************
Selection.FormatConditions.Add Type:=xlExpression, _
Formula1:="=OU(JOURSEM(" & txt & ")=1;JOURSEM(" & txt & ")=7;" & txt2 & "=""O"")"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = True
'********************************
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotEqual, _
Formula1:="="""""
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(2).Interior
.PatternColorIndex = xlAutomatic
.Color = 15773696
.TintAndShade = 0
End With
Selection.FormatConditions(2).StopIfTrue = True
'*****************************
Selection.FormatConditions.Add Type:=xlExpression, _
Formula1:= _
"=OU(" & AdrCellule_2 & "=""M"";" & AdrCellule_2 & "=""Ma"";" & AdrCellule_2 & "=""F"")"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(3).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(3).StopIfTrue = True
Positionligne = ActiveCell.Row
Positioncol = ActiveCell.Column + 1
Cells(Positionligne, Positioncol).Select
End Sub
Merci d'avance