MFC mutiples: j'ai trouvé une autre solution en vba

pascal21

XLDnaute Barbatruc
en fouillant sur le web pour un autre problème je suis tombé sur un autre moyen d'avoir de multiples MFC avec ces codes
j'utilisais jusqu'a maintenant le code de Didier (mDF)
mais celui ci est beaucoup simple
moi qui débute ce code me parais être la solution idéale à quelques soucis de MFC
1er code pour une zone définie
Code:
Sub ColorJour()

Dim cell As Range
For Each cell In Range("C:C")
  Select Case cell.Value
    Case Is = "Lundi"
    cell.Interior.ColorIndex = 0
    Case Is = "Mardi"
    cell.Interior.ColorIndex = 3
    Case Is = "Mercredi"
    cell.Interior.ColorIndex = 4
    Case Is = "Jeudi"
    cell.Interior.ColorIndex = 5
    Case Is = "Vendredi"
    cell.Interior.ColorIndex = 6
    Case Is = "Samedi"
    cell.Interior.ColorIndex = 7
    Case Is = "Dimanche"
    cell.Interior.ColorIndex = 8
  End Select
Next
End Sub
2eme code pour une feuille entière
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value = "AA" Then Target.Interior.ColorIndex = 36
If Target.Value = "BB" Then Target.Interior.ColorIndex = 34
If Target.Value = "CC" Then Target.Interior.ColorIndex = 44
If Target.Value = "DD" Then Target.Interior.ColorIndex = 39
If Target.Value <> "CC" And Target.Value <> "BB" And Target.Value <> "DD" _
And Target.Value <> "AA" Then Target.Interior.ColorIndex = 37

End Sub
voila, j'espère que ça servira à quelqu'un
en tout cas je n'ai encore pas vu cette solution sur le forum
si ça peut dépanner quelqu'un et bien tant mieux
bonne soirée
 

Discussions similaires

Statistiques des forums

Discussions
314 062
Messages
2 105 223
Membres
109 292
dernier inscrit
Habib DIOP