Bonjour a tous et toutes, forum bonjour,
Voila je voudrai bien SVP si possible simplifier ce code qui est un peu long
ce code est senser colorier les mois de l'année avec la condition suivante
Si a partir de la Colonne F2 le mot Janvier est trouver alors mettre fond en couleur 33
et ainsi de suite pour les autres mois, tous en respectant la case.
Merci de votre temps et Bonne fin d'apres midi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 Private Sub Worksheet_Change(ByVal Target As Range) Dim Nbl As Integer: Dim i As Integer Nbl = Sheets("Feuil1").[F65536].End(xlUp).Row For i = 2 To Nbl If Range("F" & i) Like "*Janvier*" Then Range("F" & i).Interior.ColorIndex = 33 End If If Range("F" & i) Like "*Février*" Then Range("F" & i).Interior.ColorIndex = 34 End If If Range("F" & i) Like "*Mars*" Then Range("F" & i).Interior.ColorIndex = 33 End If If Range("F" & i) Like "*Avril*" Then Range("F" & i).Interior.ColorIndex = 34 End If If Range("F" & i) Like "*Mai*" Then Range("F" & i).Interior.ColorIndex = 33 End If If Range("F" & i) Like "*Juin*" Then Range("F" & i).Interior.ColorIndex = 34 End If If Range("F" & i) Like "*Juillet*" Then Range("F" & i).Interior.ColorIndex = 33 End If If Range("F" & i) Like "*Août*" Then Range("F" & i).Interior.ColorIndex = 34 End If If Range("F" & i) Like "*Septembre*" Then Range("F" & i).Interior.ColorIndex = 33 End If If Range("F" & i) Like "*Octobre*" Then Range("F" & i).Interior.ColorIndex = 34 End If If Range("F" & i) Like "*Novembre*" Then Range("F" & i).Interior.ColorIndex = 33 End If If Range("F" & i) Like "*Décembre*" Then Range("F" & i).Interior.ColorIndex = 34 End If Next i End sub
Raymond
Partager