Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Excel > Macros et VBA Excel
Macros et VBA Excel Vos questions relatives aux macros Excel, à l'utilisation de VBA et à l'automatisation de vos classeurs Excel.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 18/09/2011, 17h39   #1
Invité régulier
 
veronique guyon
Inscription : mai 2010
Messages : 18
Détails du profil
Informations personnelles :
Nom : veronique guyon

Informations forums :
Inscription : mai 2010
Messages : 18
Points : 5
Points : 5
Par défaut Peut on créer 2 Worksheet_Change à la suite dans la même feuille

Bjr à tous,

J'ai créé 2 worksheet, qui marchent trés bien séparés.Peut-on en mettre 2 à la suite. (Je vous ai joint le fichier).

La 1ère worksheet rencontre un pb, car la date du jour devrait se mettre systématiquement en colonne F, lorsque l'on sélectionne dans la colonne A un texte et en C, une date. Cette macro reprend la date du systeme, pour ensuite changer savaleur pour ne pas à une prochaine ouverture se réactualiser. Elle marche trés bien seule.

La 2nde macro MFC sur plusieurs conditions en colonne A22:A25 (couleurs caractères du texte) marche également trés bien toute seule.

Est-ce que cette ligne dans la 2nde worksheet ne poserait pas des pb à la 1ere :
Code :
 If Intersect(Target, Range("A22:A25")) Is Nothing Then: Exit Sub 'Supprimer pour toute la page
Pourriez vous m'expliquer à quoi cela correspond, j'ai récupéré ces 2 macros et je les ai modifié. Je pratique depuis quelques mois, mais je suis débutante en VBA et y vais pas à pas...

Merci de votre aide !

Vérolyde
VEROLYDE est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/09/2011, 19h39   #2
Expert Confirmé Sénior
 
Avatar de jfontaine
 
Homme Jérôme FONTAINE
Contrôleur de Gestion
Inscription : juin 2006
Messages : 3 899
Détails du profil
Informations personnelles :
Nom : Homme Jérôme FONTAINE
Âge : 38
Localisation : France, Sarthe (Pays de la Loire)

Informations professionnelles :
Activité : Contrôleur de Gestion

Informations forums :
Inscription : juin 2006
Messages : 3 899
Points : 7 185
Points : 7 185
Bonjour,

Cette ligne sort de la procèdure si la cellule modifiée n'est pas dans la plage A22:A25
Code :
 If Intersect(Target, Range("A22:A25")) Is Nothing Then: Exit Sub
Pour aller plus loin il faudrait que tu postes tout le code de la procèdure
__________________
Jérôme

Citation:
"Ils ne savaient pas que c'était impossible, alors ils l'ont fait" - Marc Twain
Si la réponse répond à votre besoin, votre vote nous encouragera.
Dans le cas ou la réponse mérite, à vos yeux, un , nous faire partager la raison de ce vote, pourrait nous permettre de nous améliorer.
jfontaine est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/09/2011, 08h05   #3
Invité régulier
 
veronique guyon
Inscription : mai 2010
Messages : 18
Détails du profil
Informations personnelles :
Nom : veronique guyon

Informations forums :
Inscription : mai 2010
Messages : 18
Points : 5
Points : 5
Bjr,

Désolée, j'avais joint le fichier mais apparemment, il n'y était pas !

Voici la procédure :

Code :
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A22:A25")) Is Nothing Then: Exit Sub 'Supprimer pour toute la page
    With Target
    Select Case Target.Value
    Case Is = "A"
    .Font.ColorIndex = 3 'caractère en rouge
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CEF"
    .Font.ColorIndex = 7 'caractère en rose
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CET"
    .Font.ColorIndex = 2 'caractère en blanc
        With Selection.Interior
        .ColorIndex = 3 'fond rouge
        .Pattern = xlSolid
        End With
    Case Is = "CMAT"
    .Font.ColorIndex = 46 'caractère en orange
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CPAT"
    .Font.ColorIndex = 46 'caractère en orange
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CP"
    .Font.ColorIndex = 5 'caractère en bleu
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CP½A"
    .Font.ColorIndex = 5 'caractère en bleu
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CP½M"
    .Font.ColorIndex = 5 'caractère en bleu
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CPE"
    .Font.ColorIndex = 9 'caractère en marron
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "CSS"
    .Font.ColorIndex = 8 'caractère en turquoise
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "EMAL"
    .Font.ColorIndex = 1 'caractère en noir
        With Selection.Interior
        .ColorIndex = 7 'fond rose
        .Pattern = xlSolid
        End With
    Case Is = "EMAL½A"
    .Font.ColorIndex = 1 'caractère en noir
        With Selection.Interior
        .ColorIndex = 7 'fond rose
        .Pattern = xlSolid
        End With
    Case Is = "EMAL½M"
    .Font.ColorIndex = 1 'caractère en noir
        With Selection.Interior
        .ColorIndex = 7 'fond rose
        .Pattern = xlSolid
        End With
    Case Is = "MAL"
    .Font.ColorIndex = 1 'caractère en noir
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "MAL½A"
    .Font.ColorIndex = 1 'caractère en noir
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "MAL½M"
    .Font.ColorIndex = 1 'caractère en noir
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "RTT"
    .Font.ColorIndex = 10 'caractère en vert
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "RTT½A"
    .Font.ColorIndex = 10 'caractère en vert
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "RTT½M"
    .Font.ColorIndex = 10 'caractère en vert
        With Selection.Interior
        .ColorIndex = 2 'fond blanc
        .Pattern = xlSolid
        End With
    Case Is = "RTTE"
    .Font.ColorIndex = 2 'caractère en blanc
        With Selection.Interior
        .ColorIndex = 10 'fond vert
        .Pattern = xlSolid
        End With
    Case Is = "RTTE TRAV"
    .Font.ColorIndex = 3 'caractère en rouge
        With Selection.Interior
        .ColorIndex = 10 'fond vert
        .Pattern = xlSolid
        End With
    Case Else
    .Font.ColorIndex = xlNone
    .Interior.ColorIndex = xlNone
    End Select
    End With
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$22" Then If Not (IsEmpty(Target.Value)) Then Range("F22").Value = Now Else Range("F22").ClearContents
If Target.Address = "$C$23" Then If Not (IsEmpty(Target.Value)) Then Range("F23").Value = Now Else Range("F23").ClearContents
If Target.Address = "$C$24" Then If Not (IsEmpty(Target.Value)) Then Range("F24").Value = Now Else Range("F24").ClearContents
If Target.Address = "$C$25" Then If Not (IsEmpty(Target.Value)) Then Range("F25").Value = Now Else Range("F25").ClearContents
End Sub
Merci de votre aide !

Vérolyde

Fichiers joints VBA : http://www.developpez.net/forums/d84...s-discussions/
VEROLYDE est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/09/2011, 08h41   #4
Membre Expert
 
Homme Hervé Silve
Inscription : août 2010
Messages : 773
Détails du profil
Informations personnelles :
Nom : Homme Hervé Silve
Localisation : France

Informations forums :
Inscription : août 2010
Messages : 773
Points : 2 093
Points : 2 093
Bonjour,

Pas testé mais tu peux faire un mix des deux. Tu ne peux pas avoir deux procédures évènementielle du même nom dans le même module, le compilateur ne sachant laquelle appeler :
Code :
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
 
Private Sub Worksheet_Change(ByVal Target As Range)
 
    Application.EnableEvents = False
 
    If Target.Address = "$C$22" And Not (IsEmpty(Target.Value)) Then Range("F22").Value = Now Else Range("F22").ClearContents
    If Target.Address = "$C$23" And Not (IsEmpty(Target.Value)) Then Range("F23").Value = Now Else Range("F23").ClearContents
    If Target.Address = "$C$24" And Not (IsEmpty(Target.Value)) Then Range("F24").Value = Now Else Range("F24").ClearContents
    If Target.Address = "$C$25" And Not (IsEmpty(Target.Value)) Then Range("F25").Value = Now Else Range("F25").ClearContents
 
    Application.EnableEvents = True
 
    If Intersect(Target, Range("A22:A25")) Is Nothing Then: Exit Sub 'Supprimer pour toute la page
 
    With Target
 
        Select Case Target.Value
            Case Is = "A"
                .Font.ColorIndex = 3 'caractère en rouge
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CEF"
                .Font.ColorIndex = 7 'caractère en rose
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CET"
                .Font.ColorIndex = 2 'caractère en blanc
                With .Interior
                    .ColorIndex = 3 'fond rouge
                    .Pattern = xlSolid
                End With
            Case Is = "CMAT"
                .Font.ColorIndex = 46 'caractère en orange
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CPAT"
                .Font.ColorIndex = 46 'caractère en orange
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CP"
                .Font.ColorIndex = 5 'caractère en bleu
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CP½A"
                .Font.ColorIndex = 5 'caractère en bleu
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CP½M"
                .Font.ColorIndex = 5 'caractère en bleu
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CPE"
                .Font.ColorIndex = 9 'caractère en marron
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CSS"
                .Font.ColorIndex = 8 'caractère en turquoise
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "EMAL"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 7 'fond rose
                    .Pattern = xlSolid
                End With
            Case Is = "EMAL½A"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 7 'fond rose
                    .Pattern = xlSolid
                End With
            Case Is = "EMAL½M"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 7 'fond rose
                    .Pattern = xlSolid
                End With
            Case Is = "MAL"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "MAL½A"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "MAL½M"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTT"
                .Font.ColorIndex = 10 'caractère en vert
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTT½A"
                .Font.ColorIndex = 10 'caractère en vert
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTT½M"
                .Font.ColorIndex = 10 'caractère en vert
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTTE"
                .Font.ColorIndex = 2 'caractère en blanc
                With .Interior
                    .ColorIndex = 10 'fond vert
                    .Pattern = xlSolid
                End With
            Case Is = "RTTE TRAV"
                .Font.ColorIndex = 3 'caractère en rouge
                With .Interior
                    .ColorIndex = 10 'fond vert
                    .Pattern = xlSolid
                End With
            Case Else
                .Font.ColorIndex = xlNone
                .Interior.ColorIndex = xlNone
        End Select
 
    End With
 
End Sub
Hervé.
Theze est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/09/2011, 08h55   #5
Expert Confirmé Sénior
 
Avatar de jfontaine
 
Homme Jérôme FONTAINE
Contrôleur de Gestion
Inscription : juin 2006
Messages : 3 899
Détails du profil
Informations personnelles :
Nom : Homme Jérôme FONTAINE
Âge : 38
Localisation : France, Sarthe (Pays de la Loire)

Informations professionnelles :
Activité : Contrôleur de Gestion

Informations forums :
Inscription : juin 2006
Messages : 3 899
Points : 7 185
Points : 7 185
Je ne vois pas bien ton problème car ton code semble bien fonctionner. si ce n'est que la date se met uniquement si la Colonne F est alimentée, sans tenir compte de la colonne A

Est ce cela ton problème ?
__________________
Jérôme

Citation:
"Ils ne savaient pas que c'était impossible, alors ils l'ont fait" - Marc Twain
Si la réponse répond à votre besoin, votre vote nous encouragera.
Dans le cas ou la réponse mérite, à vos yeux, un , nous faire partager la raison de ce vote, pourrait nous permettre de nous améliorer.
jfontaine est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/09/2011, 10h11   #6
Invité régulier
 
veronique guyon
Inscription : mai 2010
Messages : 18
Détails du profil
Informations personnelles :
Nom : veronique guyon

Informations forums :
Inscription : mai 2010
Messages : 18
Points : 5
Points : 5
Par défaut Peut on créer 2 Worksheet_Change à la suite dans la même feuille

Bjr,

Je vous remercie de votre aide, mais cela ne marche pas...

Avec la méthode de Theze, merci pour ta proposition, mais cela ne marche pas.
Il ne prend toujours en compte, qu'une seule procédure et surtout
en colonne F, j'ai une fonction =SI($C22;AUJOURDHUI();"") qui s'efface systématiquement lorsque je rentre en case A, un choix, alors que la 1ère procédure devait SIMPLEMENT changer de valeur pour qu'à la prochaine ouverture, la date ne se modifie pas.

En réponse à JFontaine : Quant à ma 1ère procédure, elle marche trés bien : chgt des couleurs en colonne A, mais ne marche plus sur la colonne F qui doit mettre la date du jour, mais aussitôt doit changer la valeur de la colonne F.

Apparemment, il n'est pas possible de mettre 2 procédures à la suite...

Si vous avez d'autres idées, je suis preneuse... car j'essaies des tas de choses, mais j'avoue que je suis dépassée, un peu trop "neuve" dans le métier.

Encore merci

Vérolyde
VEROLYDE est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/09/2011, 20h14   #7
Modérateur
 
Avatar de AlainTech
 
Homme Alain Gerard
Consultant informatique
Inscription : mai 2005
Messages : 3 675
Détails du profil
Informations personnelles :
Nom : Homme Alain Gerard
Âge : 58
Localisation : Belgique

Informations professionnelles :
Activité : Consultant informatique
Secteur : Finance

Informations forums :
Inscription : mai 2005
Messages : 3 675
Points : 7 668
Points : 7 668
Citation:
Envoyé par VEROLYDE Voir le message
Il ne prend toujours en compte, qu'une seule procédure
Normal car
Citation:
Envoyé par Theze Voir le message
Tu ne peux pas avoir deux procédures évènementielle du même nom dans le même module, le compilateur ne sachant laquelle appeler
Theze t'a pourtant indiqué une manière de procéder.

Que se passe-t-il si tu utilises son code?
__________________
N'oubliez pas de cliquer sur quand vous avez obtenu ou trouvé vous-même la réponse à votre question.
Si vous trouvez seul, pensez à poster votre solution. Elle peut servir à d'autres!
Pensez aussi à voter pour les réponses qui vous ont aidés.
------------
Je dois beaucoup de mes connaissances à mes erreurs!
AlainTech est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/09/2011, 07h53   #8
Invité régulier
 
veronique guyon
Inscription : mai 2010
Messages : 18
Détails du profil
Informations personnelles :
Nom : veronique guyon

Informations forums :
Inscription : mai 2010
Messages : 18
Points : 5
Points : 5
Bjr,

Comme je l'ai indiqué précédemment dans mon msg, la proposition de THEZE ne marche pas non plus. Une seule des 2 procédures marchent (les chgts de couleurs) mais ne prend plus en compte ma demande de changer la valeur et enlève ma date.

Merci à tous ceux qui tentent de m'aider !

Je suis toujours à l'écoute...

Et continu mes recherches.

Vérolyde
VEROLYDE est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/09/2011, 09h09   #9
Membre Expert
 
Homme Hervé Silve
Inscription : août 2010
Messages : 773
Détails du profil
Informations personnelles :
Nom : Homme Hervé Silve
Localisation : France

Informations forums :
Inscription : août 2010
Messages : 773
Points : 2 093
Points : 2 093
Bonjour,

Le code se comporte tout à fait bien comme tu l'a écris seulement, la programmation c'est en grande partie de la logique et donc il faut réfléchir !
ecrire :
Code :
1
2
 
If Target.Address = "$C$22" And Not (IsEmpty(Target.Value)) Then Range("F22").Value = Now Else Range("F22").ClearContents
veux dire que si l'adresse de Target est = à $C$22 ET si Target n'est pas vide alors on exécute la commande :
Code :
1
2
 
Range("F22").Value = Now
par contre si l'adresse de Target est <> de $C$22 OU si Target est vide, on exécute la commande :
Code :
1
2
 
Range("F22").ClearContents
Donc, voici le code pour que les conditions soient testées séparément
Code :
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
 
Private Sub Worksheet_Change(ByVal Target As Range)
 
    Application.EnableEvents = False
 
    If Target.Address = "$C$22" Then
 
        If Target.Value <> "" Then
            Range("F22").Value = Now
        Else
            Range("F22").ClearContents
        End If
 
    End If
 
    If Target.Address = "$C$23" Then
 
        If Target.Value <> "" Then
            Range("F23").Value = Now
        Else
            Range("F23").ClearContents
        End If
 
    End If
 
    If Target.Address = "$C$24" Then
 
        If Target.Value <> "" Then
            Range("F24").Value = Now
        Else
            Range("F24").ClearContents
        End If
 
    End If
 
    If Target.Address = "$C$25" Then
 
        If Target.Value <> "" Then
            Range("F25").Value = Now
        Else
            Range("F25").ClearContents
        End If
 
    End If
 
    Application.EnableEvents = True
 
    If Intersect(Target, Range("A22:A25")) Is Nothing Then: Exit Sub 'Supprimer pour toute la page
 
    With Target
 
        Select Case Target.Value
            Case Is = "A"
                .Font.ColorIndex = 3 'caractère en rouge
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CEF"
                .Font.ColorIndex = 7 'caractère en rose
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CET"
                .Font.ColorIndex = 2 'caractère en blanc
                With .Interior
                    .ColorIndex = 3 'fond rouge
                    .Pattern = xlSolid
                End With
            Case Is = "CMAT"
                .Font.ColorIndex = 46 'caractère en orange
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CPAT"
                .Font.ColorIndex = 46 'caractère en orange
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CP"
                .Font.ColorIndex = 5 'caractère en bleu
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CP½A"
                .Font.ColorIndex = 5 'caractère en bleu
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CP½M"
                .Font.ColorIndex = 5 'caractère en bleu
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CPE"
                .Font.ColorIndex = 9 'caractère en marron
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "CSS"
                .Font.ColorIndex = 8 'caractère en turquoise
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "EMAL"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 7 'fond rose
                    .Pattern = xlSolid
                End With
            Case Is = "EMAL½A"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 7 'fond rose
                    .Pattern = xlSolid
                End With
            Case Is = "EMAL½M"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 7 'fond rose
                    .Pattern = xlSolid
                End With
            Case Is = "MAL"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "MAL½A"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "MAL½M"
                .Font.ColorIndex = 1 'caractère en noir
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTT"
                .Font.ColorIndex = 10 'caractère en vert
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTT½A"
                .Font.ColorIndex = 10 'caractère en vert
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTT½M"
                .Font.ColorIndex = 10 'caractère en vert
                With .Interior
                    .ColorIndex = 2 'fond blanc
                    .Pattern = xlSolid
                End With
            Case Is = "RTTE"
                .Font.ColorIndex = 2 'caractère en blanc
                With .Interior
                    .ColorIndex = 10 'fond vert
                    .Pattern = xlSolid
                End With
            Case Is = "RTTE TRAV"
                .Font.ColorIndex = 3 'caractère en rouge
                With .Interior
                    .ColorIndex = 10 'fond vert
                    .Pattern = xlSolid
                End With
            Case Else
                .Font.ColorIndex = xlNone
                .Interior.ColorIndex = xlNone
        End Select
 
    End With
 
End Sub
Hervé.
Theze est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/09/2011, 09h16   #10
Invité régulier
 
veronique guyon
Inscription : mai 2010
Messages : 18
Détails du profil
Informations personnelles :
Nom : veronique guyon

Informations forums :
Inscription : mai 2010
Messages : 18
Points : 5
Points : 5
Un grand MERCI à THEZE, tu es formidable..

Cela marche trés bien !!!!

Je tiens tout de même à remercier tous ceux qui se sont intéressés à mon pb.

Je vais en formation macro (lundi et mardi), j'espère pouvoir apporté un peu ma contribution à ceux qui auront besoin d'aide sur le forum...

Bonne journée !

Vérolyde
VEROLYDE est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/09/2011, 09h20   #11
Membre Expert
 
Homme Hervé Silve
Inscription : août 2010
Messages : 773
Détails du profil
Informations personnelles :
Nom : Homme Hervé Silve
Localisation : France

Informations forums :
Inscription : août 2010
Messages : 773
Points : 2 093
Points : 2 093
Re,

C'est aussi en aidant les autres qu'on apprend, il ne faut pas rester seul dans son coin. Si tu réponds faux à une question, personne ne t'en voudra mais pour toi ce sera une leçon apprise

Hervé.
Theze est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 02h22.


 
 
 
 
Partenaires

Hébergement Web