Petite demande supplémentaire:
Existe-t-il un tableau ou une référence où je peux trouver les "Font.ColorIndex"
actives un feuille vierge et exécutes ce code, tu auras les couleurs en colonne A et l'index correspondant en colonne B :
Sub Test()
Dim I As Integer
For I = 1 To 56
Cells(I, 1).Interior.ColorIndex = I
Cells(I, 2).Value = I
Next I
End Sub
Comment puis-je faire si j'ai plusieurs cellule qui remplissent le même format:
par ex.: "I29"; "C2"; "A1"
Avec Intersect() :
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1, C2, I29")) Is Nothing Then Exit Sub
Application.EnableEvents = False
With Range("I26")
Select Case Target.Value
Case 0
.Value = "u": .Font.Name = "Wingdings": .Font.ColorIndex = 1
Case 1
.Value = "n": .Font.Name = "Wingdings": .Font.ColorIndex = 3
Case 2
.Value = "p": .Font.Name = "Wingdings 3": .Font.ColorIndex = 44
Case 3
.Value = "l": .Font.Name = "Wingdings": .Font.ColorIndex = 43
End Select
End With
Application.EnableEvents = True
End Sub