Bonjour à tous.

J'ai une feuille excel et je copie des cellules suivant 2 conditions:
1 condition j'extrais le mois d'une date si cette cellule est remplie sinon j'extrais le mois d'une date d'une autre cellule. tout marche
je veux copie ces cellules dans une autre feuille a un endroit précis.
si c'est le mois de janvier alors je copie la cellule dans la cellule ex: .
si c'est le mois de fevrier alors la cellule qui reçoit est: .
j'ai 9 cellules a copier dans 9 autres cellules. j'ai essayer avec des function mais en mode pas a pas cela ne copie rien. Avant j'avais des si imbriquer et j'ai eu un message d'erreur la procedure est trop grande . je voulais optimiser mon code.
la feuille excel qui reçoit les cellules copier est simple je fais un sous total à chaque fin de mois, c'est pour cela que l'emplacement change.
voila mon code si on peut m'éclairer merci
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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
 
 
Sub Bouton2_Clic()
	dim arrive as integer
	dim arrivesej as integer
 
	Arrive = Month(Range("B18"))
    Arrivesej = Month(Range("B23"))
	 Workbooks.Open Filename:= _
            "\\MUMPORTABLE\Users\mum\Desktop\Antre deux\CA 2015\ca 2015.xlsx"
 
	if arrive = 1 xor arrivesej = 1  then
	L = janvier
	G = janvier
	Q = janvier
	E = janvier
	F = janvier
	C = janvier
	D = janvier
	B = janvier
	O = janvier
 
		elseif arrive = 2 xor arrivesej = 2  then
	L = fevrier
	G = fevrier
	Q = fevrier
	E = fevrier
	F = fevrier
	C = fevrier
	D = fevrier
	B = fevrier
	O = fevrier
 
	els if arrive = 3 xor arrivesej = 3  then
	L = mars
	G = mars
	Q = mars
	E = mars
	F = mars
	C = mars
	D = mars
	B = mars
	O = mars
	elseif arrive = 4 xor arrivesej = 4  then
	L = avril
	G = avril
	Q = avril
	E = avril
	F = avril
	C = avril
	D = avril
	B = avril
	O = avril
	elseif arrive = 5 xor arrivesej = 5  then
	L = mai
	G = mai
	Q = mai
	E = mai
	F = mai
	C = mai
	D = mai
	B = mai
	O = mai
	elseif arrive = 6 xor arrivesej = 6  then
	L = juin
	G = juin
	Q = juin
	E = juin
	F = juin
	C = juin
	D = juin
	B = juin
	O = juin
	elseif arrive = 7 xor arrivesej = 7  then
	L = juillet
	G = juillet
	Q = juillet
	E = juillet
	F = juillet
	C = juillet
	D = juillet
	B = juillet
	O = juillet
	elseif arrive = 8 xor arrivesej = 8  then
	L = aout
	G = aout
	Q = aout
	E = aout
	F = aout
	C = aout
	D = aout
	B = aout
	O = aout
	elseif arrive = 9 xor arrivesej = 9  then
	L = septembre
	G = septembre
	Q = septembre
	E = septembre
	F = septembre
	C = septembre
	D = septembre
	B = septembre
	O = septembre
	elseif arrive = 10 xor arrivesej = 10  then
	L = octobre
	G = octobre
	Q = octobre
	E = octobre
	F = octobre
	C = octobre	
	D = octobre
	B = octobre
	O = octobre
	elseif arrive = 11 xor arrivesej = 11  then
	L = novembre
	G = novembre
	Q = novembre
	E = novembre
	F = novembre
	C = novembre
	D = novembre
	B = novembre
	O = novembre
	elseif arrive = 12 xor arrivesej = 12  then
	L = decembre
	G = decembre
	Q = decembre
	E = decembre
	C = decembre
	D = decembre
	B = decembre
	O = decembre
 
 
 
	'*********************************************************************
        ' copie du nom de l'enfant
        '********************************************************************
 
        If Range("A15") <> "" Then
        Range("A15").Select
       Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        C.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        End If
 
		 '**********************************************************
        ' copie du prenom de l'enfant
        '***********************************************************
 
        If Range("C15") <> "" Then
        Range("C15").Select
       Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        D.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
             End If
			 '**************************************************************************
        ' 					 copie de la date d'arrive 
		'***************************************************************************
 
        If arrive = 1 xor arrive = 2 xor arrive = 3 xor arrive = 4 xor arrive = 5 xor arrive = 6 xor arrive = 7 xor arrive = 8
 xor arrive = 9 xor arrive = 10 xor arrive = 11 xor arrive = 12		Then
 
        Range("B18").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        E.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
         Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
			else if  arrivesej = 1 xor arrivesej = 2 xor arrivesej = 3 xor arrivesej = 4 xor arrivesej = 5 xor arrivesej = 6
 xor arrivesej =  7 xor arrivesej = 8 xor arrivesej = 9 xor arrivesej = 10 xor arrivesej = 11 xor arrivesej = 12			then 
 
			Range("B23").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        E.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
         Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
 
 
        End If
 
		'*******************************************************************************
        '						 copie de la date de depart
		'********************************************************************************
 
        If arrive = 1 xor arrive = 2 xor arrive = 3 xor arrive = 4 xor arrive = 5 xor arrive = 6 xor arrive = 7 xor arrive = 8
 xor arrive = 9 xor arrive = 10 xor arrive = 11 xor arrive = 12		Then
        Range("D18").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        F.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
         Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
 
			else if  arrivesej = 1 xor arrivesej = 2 xor arrivesej = 3 xor arrivesej = 4 xor arrivesej = 5 xor arrivesej = 6
 xor arrivesej =  7 xor arrivesej = 8 xor arrivesej = 9 xor arrivesej = 10 xor arrivesej = 11 xor arrivesej = 12			then 
 
			 Range("F37").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        F.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
         Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
 
 
        End If
 
		'**********************************************************************
    '  		 				copie du nombre de jours  
	'**************************************************************************
 
         If arrive = 1 xor arrive = 2 xor arrive = 3 xor arrive = 4 xor arrive = 5 xor arrive = 6 xor arrive = 7 xor arrive = 8
 xor arrive = 9 xor arrive = 10 xor arrive = 11 xor arrive = 12		Then
 
        Range("F19").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        L.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
 
			elseif  (arrivesej = 1 xor arrivesej = 2 xor arrivesej = 3 xor arrivesej = 4 xor arrivesej = 5 xor arrivesej = 6
 xor arrivesej =  7 xor arrivesej = 8 xor arrivesej = 9 xor arrivesej = 10 xor arrivesej = 11 xor arrivesej = 12	)		then 
 
			Range("F24").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        L.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
 
 
        End If
 
		'*********************************************************************************
        '  					 copie du prix sejour wekk end
		'*********************************************************************************
          If arrive = 1 xor arrive = 2 xor arrive = 3 xor arrive = 4 xor arrive = 5 xor arrive = 6 xor arrive = 7 xor arrive = 8
 xor arrive = 9 xor arrive = 10 xor arrive = 11 xor arrive = 12		Then
         Range("G19").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        G.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
         Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
			else if  arrivesej = 1 xor arrivesej = 2 xor arrivesej = 3 xor arrivesej = 4 xor arrivesej = 5 xor arrivesej = 6
 xor arrivesej =  7 xor arrivesej = 8 xor arrivesej = 9 xor arrivesej = 10 xor arrivesej = 11 xor arrivesej = 12			then 
			Range("G24").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        G.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
         Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
 
        End If
 
		'*****************************************************************************
        ' 				   recuperation du montant de la majoration
		'*****************************************************************************
        If Range("F25") > 0 and arrive = 1 xor arrive = 2 xor arrive = 3 xor arrive = 4 xor arrive = 5 xor arrive = 6 xor arrive = 7 xor arrive = 8
 xor arrive = 9 xor arrive = 10 xor arrive = 11 xor arrive = 12	 Then
        Range("H25").Select
        Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        Q.End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
         Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
 
        End If
 
		If Range("B44") <> "" Then
        Range("B44").Select
       Selection.Copy
 
        ActiveWindow.SmallScroll Down:=3
        Range("O37").End(xlUp).Offset(1, 0).Select
        'Range("M65").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
 
        End If
 
	end if
	ActiveWorkbook.Save
        ActiveWindow.Close
End Sub
 
Function janvier()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
 
	L = Range("L37")
	G = Range("L37")
	Q = Range("L37")
	E = Range("L37")
	F = Range("L37")
	C = Range("L37")
	D = Range("L37")
	B = Range("L37")
	O = Range("L37")
 
end function
 
Function fevrier()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
 
	L = Range("L40:L173")
	G = Range("L40:L173")
	Q = Range("L40:L173")
	E = Range("L40:L173")
	F = Range("L40:L173")
	C = Range("L40:L173")
	D = Range("L40:L173")
	B = Range("L40:L173")
	O = Range("L40:L173")
 
end function
 
Function mars()as string
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L176:L309")
	G = Range("L176:L309")
	Q = Range("L176:L309")
	E = Range("L176:L309")
	F = Range("L176:L309")
	C = Range("L176:L309")
	D = Range("L176:L309")
	B = Range("L176:L309")
	O = Range("L176:L309")
 
end function
 
Function avril()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L312:L445")
	G = Range("L312:L445")
	Q = Range("L312:L445")
	E = Range("L312:L445")
	F = Range("37")
	C = Range("L312:L445")
	D = Range("L312:L445")
	B = Range("L312:L445")
	O = Range("L312:L445")
 
end function
 
Function mai()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L448:L581")
	G = Range("L448:L581")
	Q = Range("L448:L581")
	E = Range("L448:L581")
	F = Range("L448:L581")
	C = Range("L448:L581")
	D = Range("L448:L581")
	B = Range("L448:L581")
	O = Range("L448:L581")
end function
 
Function juin()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L584:L717")
	G = Range("L584:L717")
	Q = Range("L584:L717")
	E = Range("L584:L717")
	F = Range("L584:L717")
	C = Range("L584:L717")
	D = Range("L584:L717")
	B = Range("L584:L717")
	O = Range("L584:L717")
 
end function
 
Function juillet()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L720:L853")
	G = Range("L720:L853")
	Q = Range("L720:L853")
	E = Range("L720:L853")
	F = Range("L720:L853")
	C = Range("L720:L853")
	D = Range("L720:L853")
	B = Range("L720:L853")
	O = Range("L720:L853")
 
end function
 
Function aout()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L856:L989")
	G = Range("L856:L989")
	Q = Range("L856:L989")
	E = Range("L856:L989")
	F = Range("L856:L989")
	C = Range("L856:L989")
	D = Range("L856:L989")
	B = Range("L856:L989")
	O = Range("L856:L989")
 
 
end function
 
Function septembre()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L992:L1125")
	G = Range("L992:L1125")
	Q = Range("L992:L1125")
	E = Range("L992:L1125")
	F = Range("L992:L1125")
	C = Range("L992:L1125")
	D = Range("L992:L1125")
	B = Range("L992:L1125")
	O = Range("L992:L1125")
 
end function
 
Function octobre()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L1128:L1261")
	G = Range("L1128:L1261")
	Q = Range("L1128:L1261")
	E = Range("L1128:L1261")
	F = Range("L1128:L1261")
	C = Range("L1128:L1261")
	D = Range("L1128:L1261")
	B = Range("L1128:L1261")
	O = Range("L1128:L1261")
 
end function
 
Function novembre()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L1264:L1397")
	G = Range("L1264:L1397")
	Q = Range("L1264:L1397")
	E = Range("L1264:L1397")
	F = Range("L1264:L1397")
	C = Range("L1264:L1397")
	D = Range("L1264:L1397")
	B = Range("L1264:L1397")
	O = Range("L1264:L1397")
 
end function
 
Function decembre()
	dim L as string, G as string, Q as string, E as string, F as string, C as string, D as string, B as string, O as string
	L = Range("L1400:L1533")
	G = Range("L1400:L1533")
	Q = Range("L1400:L1533")
	E = Range("L1400:L1533")
	F = Range("L1400:L1533")
	C = Range("L1400:L1533")
	D = Range("L1400:L1533")
	B = Range("L1400:L1533")
	O = Range("L1400:L1533")
 
end function