Bonjour X Cellus,
J'ai modifié ainsi ton code :
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Or Target.Column = 4 Then Cells(Target.Row, 10) = Cells(Target.Row, 9)
If Target.Column <> 10 Then Exit Sub
If Target.Count > 1 Then Target.Offset(, -6).Interior.ColorIndex = 2: Exit Sub
If Target.Value = "" Then Target.Offset(, -6).Interior.ColorIndex = 2: Exit Sub
'
Lig = Range("J" & Rows.Count).End(xlUp).Row
If Not Intersect(Target, Range("J2:J" & Lig)) Is Nothing Then
Chx = Target.Value + 1: Target.Offset(, -6).Interior.ColorIndex = Choose(Chx, 2, 44, 35, 22)
Chx = Target.Value + 1: Target.Offset(, -6).Font.ColorIndex = Choose(Chx, 2, 22, 44, 35)
Chx = Target.Value + 1: Target.Offset(, -6).Font.Bold = Chx
End If
End Sub
Par contre, en modifiant ainsi ce code, j'ai de nouveau le fond de cellule qui reste colorié lorsque j'efface les données :/
EDIT: J'ai essayé de reproduire ce schéma pour le Font et le Bold mais ça ne fonctionne pas.
If Target.Count > 1 Then Target.Offset(, -6).Interior.ColorIndex = 2: Exit Sub
If Target.Value = "" Then Target.Offset(, -6).Interior.ColorIndex = 2: Exit Sub
'
If Target.Count > 1 Then Target.Offset(, -6).Interior.ColorIndex = 2: Exit Sub
If Target.Value = "" Then Target.Offset(, -6).Interior.ColorIndex = 2: Exit Sub
If Target.Count > 1 Then Target.Offset(, -6).Font.ColorIndex = 2: Exit Sub
If Target.Value = "" Then Target.Offset(, -6).Font.ColorIndex = 2: Exit Sub
If Target.Count > 1 Then Target.Offset(, -6).Font.Bold = 2: Exit Sub
If Target.Value = "" Then Target.Offset(, -6).Font.Bold = 2: Exit Sub
Est-il possible de choisir des couleurs en RGB pour Choose(Chx, 2, 44, 35, 22)
et Choose(Chx, 2, 22, 44, 35)
plutôt que le code "colorindex" ?
Par exemple, je souhaiterais un rouge plus clair en fond correspondant à : rgb(255, 148, 120)
Horusbk