Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:A21")) Is Nothing Then
Target.Offset(0, 3).Value = Target
Target.Offset(0, 3).FormatConditions.AddDatabar
With Target.Offset(0, 3).FormatConditions(1)
.MinPoint.Modify newtype:=xlConditionValueNumber, newvalue:=0
.MaxPoint.Modify newtype:=xlConditionValueNumber, newvalue:=100
End With
Select Case Target.Value
Case 0 To 35
Target.Offset(0, 3).FormatConditions(1).BarColor.Color = RGB(239, 50, 69) 'Rouge foncé ' "&HFF" 'vbRed
Case 35 To 50
Target.Offset(0, 3).FormatConditions(1).BarColor.Color = RGB(237, 172, 73) 'Orange
Case 50 To 65
Target.Offset(0, 3).FormatConditions(1).BarColor.Color = RGB(161, 243, 106) 'Vert clair
Case 65 To 100
Cells(Target.Row, "D").FormatConditions(1).BarColor.Color = RGB(11, 162, 0) 'Vert foncé 'vbGreen
End Select
End If
End Sub