Bonjour,
J'ai trouve sur internet les lignes ci-dessous qui me permettent d'appliquer une mise en forme conditionnelle >3 conditions mais le traitement est affreusement long puisqu'il agit partout... je ne sais pas comment modifier ce code pour appliquer cette mise en forme sur seulement deux onglets distincts (onglet 1 "PRO" et onglet 2 "AM0") et surtout des plages de cellules bien précises pour chaque (comme C6:G6 ainsi qu'une autre zone Q6:AN23 pour l'onglet 1 et colonne E + colonne G + colonne I pour l'onglet 2). Merci de votre aide...
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 Sub Test() 'Déclaration des variables ------------------------- Dim Cel As Range Dim F As Worksheet 'MEI ---------------------------- Application.ScreenUpdating = False 'Blocage ragraîchissement écran 'Traitement------------------------ For Each F In Worksheets 'Pour chaque feuille du classeur For Each Cel In F.UsedRange 'Pour chaque cellule de la plage utilisée de la feuille Select Case Cel.Value 'définir case = valeur de cel 'couleur : vert Case "1" Cel.Interior.ColorIndex = 4 Case "1/1" Cel.Interior.ColorIndex = 4 Case "1/2" Cel.Interior.ColorIndex = 4 Case "2/1" Cel.Interior.ColorIndex = 4 Case "V" Cel.Interior.ColorIndex = 4 'couleur : jaune Case "2" Cel.Interior.ColorIndex = 6 Case "1/3" Cel.Interior.ColorIndex = 6 Case "1/4" Cel.Interior.ColorIndex = 6 Case "2/2" Cel.Interior.ColorIndex = 6 Case "3/1" Cel.Interior.ColorIndex = 6 Case "4/1" Cel.Interior.ColorIndex = 6 Case "J" Cel.Interior.ColorIndex = 6 'couleur : orange Case "3" Cel.Interior.ColorIndex = 44 Case "2/3" Cel.Interior.ColorIndex = 44 Case "2/4" Cel.Interior.ColorIndex = 44 Case "3/3" Cel.Interior.ColorIndex = 44 Case "3/2" Cel.Interior.ColorIndex = 44 Case "4/2" Cel.Interior.ColorIndex = 44 Case "O" Cel.Interior.ColorIndex = 44 'couleur : rouge Case "4" Cel.Interior.ColorIndex = 3 Case "3/4" Cel.Interior.ColorIndex = 3 Case "4/4" Cel.Interior.ColorIndex = 3 Case "4/3" Cel.Interior.ColorIndex = 3 Case "R" Cel.Interior.ColorIndex = 3 Case Else Cel.Interior.ColorIndex = xlNone End Select Next Cel Next F Application.ScreenUpdating = True End Sub






Répondre avec citation


Partager