babasss | J'ai repris le code de 86vomito33 et j'ai un peu améliorer. J'ai créé une fonction qui renvoie le paramétrage, comme ca si tu veux modifier qqch, tu le modifies une seul fois et c'est tout...
Code :
- Private Sub Worksheet_Change(ByVal Target As Excel.Range)
- If Not Intersect(Target, Range("G22:G653" )) Is Nothing Then
- With Target
- Select Case Target.Value
- Case Is < 0
- Call Coloriser_cellule(Target, 1)
- Case Is = 0
- Call Coloriser_cellule(Target, 2)
- Case Is = 1
- Call Coloriser_cellule(Target, 15)
- Case Is = 2
- Call Coloriser_cellule(Target, 6)
- Case Is = 3
- Call Coloriser_cellule(Target, 44)
- Case Is = 4
- Call Coloriser_cellule(Target, 45)
- Case Is = 5
- Call Coloriser_cellule(Target, 46)
- Case Is = 6
- Call Coloriser_cellule(Target, 28)
- Case Is = 7
- Call Coloriser_cellule(Target, 37)
- Case Is = 8
- Call Coloriser_cellule(Target, 42)
- Case Is = 9
- Call Coloriser_cellule(Target, 41)
- Case Is = 10
- Call Coloriser_cellule(Target, 26)
- Case Is = 11
- Call Coloriser_cellule(Target, 2)
- Case Is = 12
- Call Coloriser_cellule(Target, 2)
- Case Is > 12
- Call Coloriser_cellule(Target, 1)
- End Select
- End With
- End If
- End Sub
- Public Function Coloriser_cellule(ByVal Target_cellule As Excel.Range, ByVal couleur As Single)
- Target_cellule.Interior.ColorIndex = couleur
- Range(Cells(Target_cellule.Row, Target_cellule.Column + 2), Cells(Target_cellule.Row, Target_cellule.Column + 30)).Interior.ColorIndex = couleur
- End Function
|
---------------
Feedback : http://forum.hardware.fr/hfr/Achat [...] 2666_1.htm
|