Bonjour,
je suis tout novice dans le code VBA, donc il n'a pas vraiment de méthode.
Je suis en train de faire un planning dans lequel on declare les heures, les postes de travail et les employés.
En haut à gauche, il y a une autre liste qui declare le nombre de poste et qui masque en fonction certaine ligne.
Avant de masquer ces lignes j'aimerai effacer le contenu d'un certain nombre de cellules.
Quand je l'ajoute au code de la feuille, j'ai un message d'erreur ; "pile insuffisante"
Je vous colle le code : Si vous avez des suggestions sur le reste du code, je suis preneur.
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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445 ' Private Sub Worksheet_SelectionChange(ByVal Target As Range) ' [A2].Interior.ColorIndex = [Bd_Postes!a2].Interior.ColorIndex Private Sub Worksheet_Change(ByVal Target As Range) Application.ScreenUpdating = False ' Copie du format de couleur de remplissage de la cellule depuis la feuille Bd_poste If Target.Value = [Bd_Postes!a2] Then Target.Interior.ColorIndex = [Bd_Postes!a2].Interior.ColorIndex If Target.Value = [Bd_Postes!a3] Then Target.Interior.ColorIndex = [Bd_Postes!a3].Interior.ColorIndex If Target.Value = [Bd_Postes!a4] Then Target.Interior.ColorIndex = [Bd_Postes!a4].Interior.ColorIndex If Target.Value = [Bd_Postes!a5] Then Target.Interior.ColorIndex = [Bd_Postes!a5].Interior.ColorIndex If Target.Value = [Bd_Postes!a6] Then Target.Interior.ColorIndex = [Bd_Postes!a6].Interior.ColorIndex If Target.Value = [Bd_Postes!a7] Then Target.Interior.ColorIndex = [Bd_Postes!a7].Interior.ColorIndex If Target.Value = [Bd_Postes!a8] Then Target.Interior.ColorIndex = [Bd_Postes!a8].Interior.ColorIndex If Target.Value = [Bd_Postes!a9] Then Target.Interior.ColorIndex = [Bd_Postes!a9].Interior.ColorIndex If Target.Value = [Bd_Postes!a10] Then Target.Interior.ColorIndex = [Bd_Postes!a10].Interior.ColorIndex If Target.Value = [Bd_Postes!a11] Then Target.Interior.ColorIndex = [Bd_Postes!a11].Interior.ColorIndex If Target.Value = [Bd_Postes!a12] Then Target.Interior.ColorIndex = [Bd_Postes!a12].Interior.ColorIndex If Target.Value = [Bd_Postes!a13] Then Target.Interior.ColorIndex = [Bd_Postes!a13].Interior.ColorIndex If Target.Value = [Bd_Postes!a14] Then Target.Interior.ColorIndex = [Bd_Postes!a14].Interior.ColorIndex If Target.Value = [Bd_Postes!a15] Then Target.Interior.ColorIndex = [Bd_Postes!a15].Interior.ColorIndex If Target.Value = [Bd_Postes!a16] Then Target.Interior.ColorIndex = [Bd_Postes!a16].Interior.ColorIndex If Target.Value = [Bd_Postes!a17] Then Target.Interior.ColorIndex = [Bd_Postes!a17].Interior.ColorIndex If Target.Value = [Bd_Postes!a18] Then Target.Interior.ColorIndex = [Bd_Postes!a18].Interior.ColorIndex If Target.Value = [Bd_Postes!a19] Then Target.Interior.ColorIndex = [Bd_Postes!a19].Interior.ColorIndex If Target.Value = [Bd_Postes!a20] Then Target.Interior.ColorIndex = [Bd_Postes!a20].Interior.ColorIndex If Target.Value = [Bd_Postes!a21] Then Target.Interior.ColorIndex = [Bd_Postes!a21].Interior.ColorIndex If Target.Value = [Bd_Postes!a22] Then Target.Interior.ColorIndex = [Bd_Postes!a22].Interior.ColorIndex If Target.Value = [Bd_Postes!a23] Then Target.Interior.ColorIndex = [Bd_Postes!a23].Interior.ColorIndex If Target.Value = [Bd_Postes!a24] Then Target.Interior.ColorIndex = [Bd_Postes!a24].Interior.ColorIndex If Target.Value = [Bd_Postes!a25] Then Target.Interior.ColorIndex = [Bd_Postes!a25].Interior.ColorIndex If Target.Value = [Bd_Postes!a26] Then Target.Interior.ColorIndex = [Bd_Postes!a26].Interior.ColorIndex If Target.Value = [Bd_Postes!a27] Then Target.Interior.ColorIndex = [Bd_Postes!a27].Interior.ColorIndex If Target.Value = [Bd_Postes!a28] Then Target.Interior.ColorIndex = [Bd_Postes!a28].Interior.ColorIndex If Target.Value = [Bd_Postes!a29] Then Target.Interior.ColorIndex = [Bd_Postes!a29].Interior.ColorIndex If Target.Value = [Bd_Postes!a30] Then Target.Interior.ColorIndex = [Bd_Postes!a30].Interior.ColorIndex ' Copie du format de couleur de texte de la cellule depuis la feuille Bd_poste If Target.Value = [Bd_Postes!a2] Then Target.Font.ColorIndex = [Bd_Postes!a2].Font.ColorIndex If Target.Value = [Bd_Postes!a3] Then Target.Font.ColorIndex = [Bd_Postes!a3].Font.ColorIndex If Target.Value = [Bd_Postes!a4] Then Target.Font.ColorIndex = [Bd_Postes!a4].Font.ColorIndex If Target.Value = [Bd_Postes!a5] Then Target.Font.ColorIndex = [Bd_Postes!a5].Font.ColorIndex If Target.Value = [Bd_Postes!a6] Then Target.Font.ColorIndex = [Bd_Postes!a6].Font.ColorIndex If Target.Value = [Bd_Postes!a7] Then Target.Font.ColorIndex = [Bd_Postes!a7].Font.ColorIndex If Target.Value = [Bd_Postes!a8] Then Target.Font.ColorIndex = [Bd_Postes!a8].Font.ColorIndex If Target.Value = [Bd_Postes!a9] Then Target.Font.ColorIndex = [Bd_Postes!a9].Font.ColorIndex If Target.Value = [Bd_Postes!a10] Then Target.Font.ColorIndex = [Bd_Postes!a10].Font.ColorIndex If Target.Value = [Bd_Postes!a11] Then Target.Font.ColorIndex = [Bd_Postes!11].Font.ColorIndex If Target.Value = [Bd_Postes!a12] Then Target.Font.ColorIndex = [Bd_Postes!a12].Font.ColorIndex If Target.Value = [Bd_Postes!a13] Then Target.Font.ColorIndex = [Bd_Postes!a13].Font.ColorIndex If Target.Value = [Bd_Postes!a14] Then Target.Font.ColorIndex = [Bd_Postes!a14].Font.ColorIndex If Target.Value = [Bd_Postes!a15] Then Target.Font.ColorIndex = [Bd_Postes!a15].Font.ColorIndex If Target.Value = [Bd_Postes!a16] Then Target.Font.ColorIndex = [Bd_Postes!a16].Font.ColorIndex If Target.Value = [Bd_Postes!a17] Then Target.Font.ColorIndex = [Bd_Postes!a17].Font.ColorIndex If Target.Value = [Bd_Postes!a18] Then Target.Font.ColorIndex = [Bd_Postes!a18].Font.ColorIndex If Target.Value = [Bd_Postes!a19] Then Target.Font.ColorIndex = [Bd_Postes!a19].Font.ColorIndex If Target.Value = [Bd_Postes!a20] Then Target.Font.ColorIndex = [Bd_Postes!a20].Font.ColorIndex If Target.Value = [Bd_Postes!a21] Then Target.Font.ColorIndex = [Bd_Postes!a21].Font.ColorIndex If Target.Value = [Bd_Postes!a22] Then Target.Font.ColorIndex = [Bd_Postes!a22].Font.ColorIndex If Target.Value = [Bd_Postes!a23] Then Target.Font.ColorIndex = [Bd_Postes!a23].Font.ColorIndex If Target.Value = [Bd_Postes!a24] Then Target.Font.ColorIndex = [Bd_Postes!a24].Font.ColorIndex If Target.Value = [Bd_Postes!a25] Then Target.Font.ColorIndex = [Bd_Postes!a25].Font.ColorIndex If Target.Value = [Bd_Postes!a26] Then Target.Font.ColorIndex = [Bd_Postes!a26].Font.ColorIndex If Target.Value = [Bd_Postes!a27] Then Target.Font.ColorIndex = [Bd_Postes!a27].Font.ColorIndex If Target.Value = [Bd_Postes!a28] Then Target.Font.ColorIndex = [Bd_Postes!a28].Font.ColorIndex If Target.Value = [Bd_Postes!a29] Then Target.Font.ColorIndex = [Bd_Postes!a29].Font.ColorIndex If Target.Value = [Bd_Postes!a30] Then Target.Font.ColorIndex = [Bd_Postes!a30].Font.ColorIndex ' Copie de format de couleur depuis la colonne "poste" pour le matin [D4:F4].Interior.ColorIndex = [B4].Interior.ColorIndex [D5:F5].Interior.ColorIndex = [B5].Interior.ColorIndex [D6:F6].Interior.ColorIndex = [B6].Interior.ColorIndex [D7:F7].Interior.ColorIndex = [B7].Interior.ColorIndex [D8:F8].Interior.ColorIndex = [B8].Interior.ColorIndex [D9:F9].Interior.ColorIndex = [B9].Interior.ColorIndex [D10:F10].Interior.ColorIndex = [B10].Interior.ColorIndex [D11:F11].Interior.ColorIndex = [B11].Interior.ColorIndex [D12:F12].Interior.ColorIndex = [B12].Interior.ColorIndex [D13:F13].Interior.ColorIndex = [B13].Interior.ColorIndex [D14:F14].Interior.ColorIndex = [B14].Interior.ColorIndex [D15:F15].Interior.ColorIndex = [B15].Interior.ColorIndex [D16:F16].Interior.ColorIndex = [B16].Interior.ColorIndex [D17:F17].Interior.ColorIndex = [B17].Interior.ColorIndex [D18:F18].Interior.ColorIndex = [B18].Interior.ColorIndex [D19:F19].Interior.ColorIndex = [B19].Interior.ColorIndex [D20:F20].Interior.ColorIndex = [B20].Interior.ColorIndex [D21:F21].Interior.ColorIndex = [B21].Interior.ColorIndex [D22:F22].Interior.ColorIndex = [B22].Interior.ColorIndex [D23:F23].Interior.ColorIndex = [B23].Interior.ColorIndex [D24:F24].Interior.ColorIndex = [B24].Interior.ColorIndex [D25:F25].Interior.ColorIndex = [B25].Interior.ColorIndex [D26:F26].Interior.ColorIndex = [B26].Interior.ColorIndex [D27:F27].Interior.ColorIndex = [B27].Interior.ColorIndex [D28:F28].Interior.ColorIndex = [B28].Interior.ColorIndex [D29:F29].Interior.ColorIndex = [B29].Interior.ColorIndex [D30:F30].Interior.ColorIndex = [B30].Interior.ColorIndex [D31:F31].Interior.ColorIndex = [B31].Interior.ColorIndex [D32:F32].Interior.ColorIndex = [B32].Interior.ColorIndex [D33:F33].Interior.ColorIndex = [B33].Interior.ColorIndex [D34:F34].Interior.ColorIndex = [B34].Interior.ColorIndex [D35:F35].Interior.ColorIndex = [B35].Interior.ColorIndex [D36:F36].Interior.ColorIndex = [B36].Interior.ColorIndex [D37:F37].Interior.ColorIndex = [B37].Interior.ColorIndex [D38:F38].Interior.ColorIndex = [B38].Interior.ColorIndex [D39:F39].Interior.ColorIndex = [B39].Interior.ColorIndex [D40:F40].Interior.ColorIndex = [B40].Interior.ColorIndex [D41:F41].Interior.ColorIndex = [B41].Interior.ColorIndex [D42:F42].Interior.ColorIndex = [B42].Interior.ColorIndex [D43:F43].Interior.ColorIndex = [B43].Interior.ColorIndex [D44:F44].Interior.ColorIndex = [B44].Interior.ColorIndex [D45:F45].Interior.ColorIndex = [B45].Interior.ColorIndex [D46:F46].Interior.ColorIndex = [B46].Interior.ColorIndex [D47:F47].Interior.ColorIndex = [B47].Interior.ColorIndex [D48:F48].Interior.ColorIndex = [B48].Interior.ColorIndex [D49:F49].Interior.ColorIndex = [B49].Interior.ColorIndex [D50:F50].Interior.ColorIndex = [B50].Interior.ColorIndex [D51:F51].Interior.ColorIndex = [B51].Interior.ColorIndex [D52:F52].Interior.ColorIndex = [B52].Interior.ColorIndex [D53:F53].Interior.ColorIndex = [B53].Interior.ColorIndex [D54:F54].Interior.ColorIndex = [B54].Interior.ColorIndex [D55:F55].Interior.ColorIndex = [B55].Interior.ColorIndex [D56:F56].Interior.ColorIndex = [B56].Interior.ColorIndex [D57:F57].Interior.ColorIndex = [B57].Interior.ColorIndex [D58:F58].Interior.ColorIndex = [B58].Interior.ColorIndex [D59:F59].Interior.ColorIndex = [B59].Interior.ColorIndex [D60:F60].Interior.ColorIndex = [B60].Interior.ColorIndex ' Copie de format de couleur depuis la colonne poste pour l'après midi [J4:L4].Interior.ColorIndex = [H4].Interior.ColorIndex [J5:L5].Interior.ColorIndex = [H5].Interior.ColorIndex [J6:L6].Interior.ColorIndex = [H6].Interior.ColorIndex [J7:L7].Interior.ColorIndex = [H7].Interior.ColorIndex [J8:L8].Interior.ColorIndex = [H8].Interior.ColorIndex [J9:L9].Interior.ColorIndex = [H9].Interior.ColorIndex [J10:L10].Interior.ColorIndex = [H10].Interior.ColorIndex [J11:L11].Interior.ColorIndex = [H11].Interior.ColorIndex [J12:L12].Interior.ColorIndex = [H12].Interior.ColorIndex [J13:L13].Interior.ColorIndex = [H13].Interior.ColorIndex [J14:L14].Interior.ColorIndex = [H14].Interior.ColorIndex [J15:L15].Interior.ColorIndex = [H15].Interior.ColorIndex [J16:L16].Interior.ColorIndex = [H16].Interior.ColorIndex [J17:L17].Interior.ColorIndex = [H17].Interior.ColorIndex [J18:L18].Interior.ColorIndex = [H18].Interior.ColorIndex [J19:L19].Interior.ColorIndex = [H19].Interior.ColorIndex [J20:L20].Interior.ColorIndex = [H20].Interior.ColorIndex [J21:L21].Interior.ColorIndex = [H21].Interior.ColorIndex [J22:L22].Interior.ColorIndex = [H22].Interior.ColorIndex [J23:L23].Interior.ColorIndex = [H23].Interior.ColorIndex [J24:L24].Interior.ColorIndex = [H24].Interior.ColorIndex [J25:L25].Interior.ColorIndex = [H25].Interior.ColorIndex [J26:L26].Interior.ColorIndex = [H26].Interior.ColorIndex [J27:L27].Interior.ColorIndex = [H27].Interior.ColorIndex [J28:L28].Interior.ColorIndex = [H28].Interior.ColorIndex [J29:L29].Interior.ColorIndex = [H29].Interior.ColorIndex [J30:L30].Interior.ColorIndex = [H30].Interior.ColorIndex [J31:L31].Interior.ColorIndex = [H31].Interior.ColorIndex [J32:L32].Interior.ColorIndex = [H32].Interior.ColorIndex [J33:L33].Interior.ColorIndex = [H33].Interior.ColorIndex [J34:L34].Interior.ColorIndex = [H34].Interior.ColorIndex [J35:L35].Interior.ColorIndex = [H35].Interior.ColorIndex [J36:L36].Interior.ColorIndex = [H36].Interior.ColorIndex [J37:L37].Interior.ColorIndex = [H37].Interior.ColorIndex [J38:L38].Interior.ColorIndex = [H38].Interior.ColorIndex [J39:L39].Interior.ColorIndex = [H39].Interior.ColorIndex [J40:L40].Interior.ColorIndex = [H40].Interior.ColorIndex [J41:L41].Interior.ColorIndex = [H41].Interior.ColorIndex [J42:L42].Interior.ColorIndex = [H42].Interior.ColorIndex [J43:L43].Interior.ColorIndex = [H43].Interior.ColorIndex [J44:L44].Interior.ColorIndex = [H44].Interior.ColorIndex [J45:L45].Interior.ColorIndex = [H45].Interior.ColorIndex [J46:L46].Interior.ColorIndex = [H46].Interior.ColorIndex [J47:L47].Interior.ColorIndex = [H47].Interior.ColorIndex [J48:L48].Interior.ColorIndex = [H48].Interior.ColorIndex [J49:L49].Interior.ColorIndex = [H49].Interior.ColorIndex [J50:L50].Interior.ColorIndex = [H50].Interior.ColorIndex [J51:L51].Interior.ColorIndex = [H51].Interior.ColorIndex [J52:L52].Interior.ColorIndex = [H52].Interior.ColorIndex [J53:L53].Interior.ColorIndex = [H53].Interior.ColorIndex [J54:L54].Interior.ColorIndex = [H54].Interior.ColorIndex [J55:L55].Interior.ColorIndex = [H55].Interior.ColorIndex [J56:L56].Interior.ColorIndex = [H56].Interior.ColorIndex [J57:L57].Interior.ColorIndex = [H57].Interior.ColorIndex [J58:L58].Interior.ColorIndex = [H58].Interior.ColorIndex [J59:L59].Interior.ColorIndex = [H59].Interior.ColorIndex [J60:L60].Interior.ColorIndex = [H60].Interior.ColorIndex 'Copie de la couleur de texte depuis la colonne "poste" pour le matin [D4:F4].Font.ColorIndex = [B4].Font.ColorIndex [D5:F5].Font.ColorIndex = [B5].Font.ColorIndex [D6:F6].Font.ColorIndex = [B6].Font.ColorIndex [D7:F7].Font.ColorIndex = [B7].Font.ColorIndex [D8:F8].Font.ColorIndex = [B8].Font.ColorIndex [D9:F9].Font.ColorIndex = [B9].Font.ColorIndex [D10:F10].Font.ColorIndex = [B10].Font.ColorIndex [D11:F11].Font.ColorIndex = [B11].Font.ColorIndex [D12:F12].Font.ColorIndex = [B12].Font.ColorIndex [D13:F13].Font.ColorIndex = [B13].Font.ColorIndex [D14:F14].Font.ColorIndex = [B14].Font.ColorIndex [D15:F15].Font.ColorIndex = [B15].Font.ColorIndex [D16:F16].Font.ColorIndex = [B16].Font.ColorIndex [D17:F17].Font.ColorIndex = [B17].Font.ColorIndex [D18:F18].Font.ColorIndex = [B18].Font.ColorIndex [D19:F19].Font.ColorIndex = [B19].Font.ColorIndex [D20:F20].Font.ColorIndex = [B20].Font.ColorIndex [D21:F21].Font.ColorIndex = [B21].Font.ColorIndex [D22:F22].Font.ColorIndex = [B22].Font.ColorIndex [D23:F23].Font.ColorIndex = [B23].Font.ColorIndex [D24:F24].Font.ColorIndex = [B24].Font.ColorIndex [D25:F25].Font.ColorIndex = [B25].Font.ColorIndex [D26:F26].Font.ColorIndex = [B26].Font.ColorIndex [D27:F27].Font.ColorIndex = [B27].Font.ColorIndex [D28:F28].Font.ColorIndex = [B28].Font.ColorIndex [D29:F29].Font.ColorIndex = [B29].Font.ColorIndex [D30:F30].Font.ColorIndex = [B30].Font.ColorIndex [D31:F31].Font.ColorIndex = [B31].Font.ColorIndex [D32:F32].Font.ColorIndex = [B32].Font.ColorIndex [D33:F33].Font.ColorIndex = [B33].Font.ColorIndex [D34:F34].Font.ColorIndex = [B34].Font.ColorIndex [D35:F35].Font.ColorIndex = [B35].Font.ColorIndex [D36:F36].Font.ColorIndex = [B36].Font.ColorIndex [D37:F37].Font.ColorIndex = [B37].Font.ColorIndex [D38:F38].Font.ColorIndex = [B38].Font.ColorIndex [D39:F39].Font.ColorIndex = [B39].Font.ColorIndex [D40:F40].Font.ColorIndex = [B40].Font.ColorIndex [D41:F41].Font.ColorIndex = [B41].Font.ColorIndex [D42:F42].Font.ColorIndex = [B42].Font.ColorIndex [D43:F43].Font.ColorIndex = [B43].Font.ColorIndex [D44:F44].Font.ColorIndex = [B44].Font.ColorIndex [D45:F45].Font.ColorIndex = [B45].Font.ColorIndex [D46:F46].Font.ColorIndex = [B46].Font.ColorIndex [D47:F47].Font.ColorIndex = [B47].Font.ColorIndex [D48:F48].Font.ColorIndex = [B48].Font.ColorIndex [D49:F49].Font.ColorIndex = [B49].Font.ColorIndex [D50:F50].Font.ColorIndex = [B50].Font.ColorIndex [D51:F51].Font.ColorIndex = [B51].Font.ColorIndex [D52:F52].Font.ColorIndex = [B52].Font.ColorIndex [D53:F53].Font.ColorIndex = [B53].Font.ColorIndex [D54:F54].Font.ColorIndex = [B54].Font.ColorIndex [D55:F55].Font.ColorIndex = [B55].Font.ColorIndex [D56:F56].Font.ColorIndex = [B56].Font.ColorIndex [D57:F57].Font.ColorIndex = [B57].Font.ColorIndex [D58:F58].Font.ColorIndex = [B58].Font.ColorIndex [D59:F59].Font.ColorIndex = [B59].Font.ColorIndex [D60:F60].Font.ColorIndex = [B60].Font.ColorIndex ' Copie de la couleur de texte depuis la colonne poste pour l'après midi [J4:L4].Font.ColorIndex = [H4].Font.ColorIndex [J5:L5].Font.ColorIndex = [H5].Font.ColorIndex [J6:L6].Font.ColorIndex = [H6].Font.ColorIndex [J7:L7].Font.ColorIndex = [H7].Font.ColorIndex [J8:L8].Font.ColorIndex = [H8].Font.ColorIndex [J9:L9].Font.ColorIndex = [H9].Font.ColorIndex [J10:L10].Font.ColorIndex = [H10].Font.ColorIndex [J11:L11].Font.ColorIndex = [H11].Font.ColorIndex [J12:L12].Font.ColorIndex = [H12].Font.ColorIndex [J13:L13].Font.ColorIndex = [H13].Font.ColorIndex [J14:L14].Font.ColorIndex = [H14].Font.ColorIndex [J15:L15].Font.ColorIndex = [H15].Font.ColorIndex [J16:L16].Font.ColorIndex = [H16].Font.ColorIndex [J17:L17].Font.ColorIndex = [H17].Font.ColorIndex [J18:L18].Font.ColorIndex = [H18].Font.ColorIndex [J19:L19].Font.ColorIndex = [H19].Font.ColorIndex [J20:L20].Font.ColorIndex = [H20].Font.ColorIndex [J21:L21].Font.ColorIndex = [H21].Font.ColorIndex [J22:L22].Font.ColorIndex = [H22].Font.ColorIndex [J23:L23].Font.ColorIndex = [H23].Font.ColorIndex [J24:L24].Font.ColorIndex = [H24].Font.ColorIndex [J25:L25].Font.ColorIndex = [H25].Font.ColorIndex [J26:L26].Font.ColorIndex = [H26].Font.ColorIndex [J27:L27].Font.ColorIndex = [H27].Font.ColorIndex [J28:L28].Font.ColorIndex = [H28].Font.ColorIndex [J29:L29].Font.ColorIndex = [H29].Font.ColorIndex [J30:L30].Font.ColorIndex = [H30].Font.ColorIndex [J31:L31].Font.ColorIndex = [H31].Font.ColorIndex [J32:L32].Font.ColorIndex = [H32].Font.ColorIndex [J33:L33].Font.ColorIndex = [H33].Font.ColorIndex [J34:L34].Font.ColorIndex = [H34].Font.ColorIndex [J35:L35].Font.ColorIndex = [H35].Font.ColorIndex [J36:L36].Font.ColorIndex = [H36].Font.ColorIndex [J37:L37].Font.ColorIndex = [H37].Font.ColorIndex [J38:L38].Font.ColorIndex = [H38].Font.ColorIndex [J39:L39].Font.ColorIndex = [H39].Font.ColorIndex [J40:L40].Font.ColorIndex = [H40].Font.ColorIndex [J41:L41].Font.ColorIndex = [H41].Font.ColorIndex [J42:L42].Font.ColorIndex = [H42].Font.ColorIndex [J43:L43].Font.ColorIndex = [H43].Font.ColorIndex [J44:L44].Font.ColorIndex = [H44].Font.ColorIndex [J45:L45].Font.ColorIndex = [H45].Font.ColorIndex [J46:L46].Font.ColorIndex = [H46].Font.ColorIndex [J47:L47].Font.ColorIndex = [H47].Font.ColorIndex [J48:L48].Font.ColorIndex = [H48].Font.ColorIndex [J49:L49].Font.ColorIndex = [H49].Font.ColorIndex [J50:L50].Font.ColorIndex = [H50].Font.ColorIndex [J51:L51].Font.ColorIndex = [H51].Font.ColorIndex [J52:L52].Font.ColorIndex = [H52].Font.ColorIndex [J53:L53].Font.ColorIndex = [H53].Font.ColorIndex [J54:L54].Font.ColorIndex = [H54].Font.ColorIndex [J55:L55].Font.ColorIndex = [H55].Font.ColorIndex [J56:L56].Font.ColorIndex = [H56].Font.ColorIndex [J57:L57].Font.ColorIndex = [H57].Font.ColorIndex [J58:L58].Font.ColorIndex = [H58].Font.ColorIndex [J59:L59].Font.ColorIndex = [H59].Font.ColorIndex [J60:L60].Font.ColorIndex = [H60].Font.ColorIndex If Range("A1").Select Then Call nbposte End Sub Public Sub nbposte() ' Effacer les cellules suivantes : 'Range("P9:P12").Select 'Selection.ClearContents If Range("A1") = "1" Then Cells.Select Selection.EntireRow.Hidden = False ' Planning 1 postes - masque des lignes Rows("4:10").EntireRow.Hidden = True Rows("12:18").EntireRow.Hidden = True Rows("20:27").EntireRow.Hidden = True Rows("29:35").EntireRow.Hidden = True Rows("37:43").EntireRow.Hidden = True Rows("45:51").EntireRow.Hidden = True Rows("53:59").EntireRow.Hidden = True 'Definir le nombre de poste pour l'affichage du planning End If If Range("A1") = "2" Then Cells.Select Selection.EntireRow.Hidden = False ' Planning 2 postes - masque des lignes Rows("5:10").EntireRow.Hidden = True Rows("13:18").EntireRow.Hidden = True Rows("21:27").EntireRow.Hidden = True Rows("30:35").EntireRow.Hidden = True Rows("38:43").EntireRow.Hidden = True Rows("46:51").EntireRow.Hidden = True Rows("54:59").EntireRow.Hidden = True End If Range("A2").Select ' Planning 3 postes - masque des lignes If Range("A1") = "3" Then Cells.Select Selection.EntireRow.Hidden = False Rows("6:10").EntireRow.Hidden = True Rows("14:18").EntireRow.Hidden = True Rows("22:27").EntireRow.Hidden = True Rows("31:35").EntireRow.Hidden = True Rows("39:43").EntireRow.Hidden = True Rows("47:51").EntireRow.Hidden = True Rows("55:59").EntireRow.Hidden = True End If Range("A2").Select ' Planning 4 postes - masque des lignes If Range("A1") = "4" Then Cells.Select Selection.EntireRow.Hidden = False Rows("7:10").EntireRow.Hidden = True Rows("15:18").EntireRow.Hidden = True Rows("23:27").EntireRow.Hidden = True Rows("32:35").EntireRow.Hidden = True Rows("40:43").EntireRow.Hidden = True Rows("48:51").EntireRow.Hidden = True Rows("56:59").EntireRow.Hidden = True End If Range("A2").Select ' Planning 5 postes - masque des lignes If Range("A1") = "5" Then Cells.Select Selection.EntireRow.Hidden = False Rows("8:10").EntireRow.Hidden = True Rows("16:18").EntireRow.Hidden = True Rows("24:27").EntireRow.Hidden = True Rows("33:35").EntireRow.Hidden = True Rows("41:43").EntireRow.Hidden = True Rows("49:51").EntireRow.Hidden = True Rows("57:59").EntireRow.Hidden = True End If Range("A2").Select ' Planning 6 postes - masque des lignes If Range("A1") = "6" Then Cells.Select Selection.EntireRow.Hidden = False Rows("9:10").EntireRow.Hidden = True Rows("17:18").EntireRow.Hidden = True Rows("25:27").EntireRow.Hidden = True Rows("34:35").EntireRow.Hidden = True Rows("42:43").EntireRow.Hidden = True Rows("50:51").EntireRow.Hidden = True Rows("57:59").EntireRow.Hidden = True End If Range("A2").Select ' Planning 7 postes - masque des lignes If Range("A1") = "7" Then Cells.Select Selection.EntireRow.Hidden = False Rows("10").EntireRow.Hidden = True Rows("18").EntireRow.Hidden = True Rows("19").EntireRow.Hidden = True Rows("20").EntireRow.Hidden = True Rows("21").EntireRow.Hidden = True Rows("22").EntireRow.Hidden = True Rows("23").EntireRow.Hidden = True End If Range("A2").Select ' Planning 8 postes - masque des lignes If Range("A1") = "8" Then Cells.Select Selection.EntireRow.Hidden = False Range("A2").Select End If End Sub
Partager