Afficher un message
Vieux 04/09/2004, 20h45   #2 (permalink)
René du var
Guest
 
Messages: n/a
Par défaut Re: Couleur cellule celon valeur

Bonsoir le forum,

Voici un solution que tu dois adapter à ton prblème




METTRE DANS LA FEUILLE CONCERNER
Private Sub Worksheet_Change(ByVal Target As Range)
Call MFC_Colorie_Cellules(Target)
End Sub


METTRE DANS UN MODULE
Sub MFC_Colorie_Cellules(Target)

Dim c As Range
For Each c In ActiveSheet.Range("A1:J200")
If c = "" Then
c.Interior.ColorIndex = 0
ElseIf c >= 1 And c < 11 Then
c.Interior.ColorIndex = 8
ElseIf c > 10 And c < 21 Then
c.Interior.ColorIndex = 23
ElseIf c > 20 And c < 31 Then
c.Interior.ColorIndex = 36
ElseIf c > 30 And c < 41 Then
c.Interior.ColorIndex = 37
ElseIf c > 40 And c < 51 Then
c.Interior.ColorIndex = 36
ElseIf c > 50 And c < 61 Then
c.Interior.ColorIndex = 38
ElseIf c > 60 And c < 71 Then
c.Interior.ColorIndex = 39
ElseIf c > 70 And c < 81 Then
c.Interior.ColorIndex = 45
ElseIf c > 80 And c < 91 Then
c.Interior.ColorIndex = 40
ElseIf c > 90 And c < 101 Then
c.Interior.ColorIndex = 41
ElseIf c > 100 And c < 111 Then
c.Interior.ColorIndex = 42
End If
Next
End Sub

René du var