Bonjour à nouveau,
Ce code marche bien quand les variable sont statique et déclaré avant
sub test ()
Public Const Action_Type_1= "OUT"
Public Const Action_Type_2= "OUT2"
Public Const Action_Type_3= "OUT3"
Public Const Action_Type_4= "OUT4"
Public Const Action_Type_5= "OUT5"
With Worksheets(Plans).Range(Cells(3, 5).Address & ":" & Cells(Rows.Count, 5).End(xlUp).Address)
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Action_Type_1 & "," & Action_Type_2 & "," & Action_Type_3 & "," & Action_Type_4 & "," & Action_Type_5
.ErrorMessage = "You don't have the persmissison to write"
End With
With .FormatConditions
.Delete
.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""" & Action_Type_1 & """"
.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""" & Action_Type_2 & """"
.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""" & Action_Type_3 & """"
.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""" & Action_Type_4 & """"
.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""" & Action_Type_5 & """"
End With
.FormatConditions(1).Interior.ColorIndex = 2
.FormatConditions(2).Interior.ColorIndex = 5
.FormatConditions(3).Interior.ColorIndex = 2
.FormatConditions(4).Interior.ColorIndex = 26
.FormatConditions(5).Interior.ColorIndex = 2
End With
end sub
mais dans mon cas, la liste sera dynamique .... je ne sais pas ou ça peut etre le problème