Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long, lig As Long, plage As Range
If Target.Column = 6 And Target.Count = 1 Then
Application.EnableEvents = False
If Application.CountIf(Range("F:F"), Target.Value) > 1 Then
i = Application.Match(Target.Value, Range("F:F"), 0)
Target.Offset(0, -2).Value = Cells(i, 4).Value
Target.Offset(0, -1).Value = Cells(i, 5).Value
Else
Target.Offset(0, 1).Resize(1, 2).ClearContents
End If
Application.EnableEvents = True
End If
If Intersect(Target, Range("S5:S7000")) Is Nothing Then Exit Sub
lig = Target.Row
Set plage = Range(Cells(lig, 1), Cells(lig, 26))
Select Case Target
Case Is = "X"
plage.Interior.ColorIndex = 6 'Jaune pâle pour "X"
Case Is = "1"
plage.Interior.ColorIndex = 27 'Jaune foncé pour "1"
Case Is = "En attente clt"""
plage.Interior.ColorIndex = 34 'Bleu clair pour "En attente clt"
Case Is = ""
plage.Interior.ColorIndex = 35 'Vert clair pour ""
Case Is = "0"
plage.Interior.ColorIndex = 3 'Rouge pour "0"
Case Is = "Y"
plage.Interior.ColorIndex = 10 'Vert pour "Y"
Case Else
plage.Interior.ColorIndex = -4142 ' enlève la couleur '
End Select
Set plage = Nothing
End Sub