Bonjour à tous

J'ai sur une feuille A4, 4 fois le même tableau (en carré)
Les 4 tableaux renvois vers les mêmes formules de calcul pour des personnes différentes.

Ci joint ma macro :

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
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Variables des différents tableaux
Dim t1eh As Integer
Dim t2eh As Integer
Dim t3eh As Integer
Dim t4eh As Integer
Dim t1eq As Integer
Dim t2eq As Integer
Dim t3eq As Integer
Dim t4eq As Integer
 
'Automatisation cellule 1er tableau (haut à gauche) éléments en heures
For t1eh = 7 To 12
If Target.Address = "$G$ & t1eh" Then
Else
If Range("G" & t1eh) = "" Then
Cells(t1eh, 9) = ""
Else
End If
If Range("G" & t1eh) = "Intervention astreinte jour" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!I:I;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Majoration férié travaillé" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!J:J;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Majoration de dimanche" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!K:K;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Majoration de nuit" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!L:L;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Intervention astreinte nuit" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!M:M;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Heures à 100%" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!N:N;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Heures à 110%" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!O:O;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)+SOMME.SI.ENS(Variables!S:S;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Heures à 125%" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!P:P;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)+SOMME.SI.ENS(Variables!Q:Q;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)+SOMME.SI.ENS(Variables!T:T;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eh) = "Heures à 150%" Then
Cells(t1eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!R:R;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
End If
Next
'Automatisation cellule 1er tableau (haut à gauche) éléments en quantité
For t1eq = 15 To 21
If Target.Address = "$G$ & t1eq" Then
Else
If Range("G" & t1eq) = "" Then
Cells(t1eq, 9) = ""
Else
End If
If Range("G" & t1eq) = "Panier jour taxable" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!F:F;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eq) = "Indemnité astreinte dimanche" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!G:G;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eq) = "Indemnité astreinte semaine" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!H:H;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eq) = "Panier jour non taxable" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!U:U;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eq) = "Panier nuit non taxable" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eq) = "Panier nuit taxable" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eq) = "IPCM non taxable" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
If Range("G" & t1eq) = "IPCM taxable" Then
Cells(t1eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;C5;Variables!D:D;"">=""&C9;Variables!D:D;""<=""&C10)"
Else
End If
End If
Next
 
 
'Automatisation cellule 2ème tableau (haut à droite) éléments en heures
For t2eh = 7 To 12
If Target.Address = "$R$ & t2eh" Then
Else
If Range("R" & t2eh) = "" Then
Cells(t2eh, 20) = ""
Else
End If
If Range("R" & t2eh) = "Intervention astreinte jour" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!I:I;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Majoration férié travaillé" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!J:J;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Majoration de dimanche" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!K:K;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Majoration de nuit" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!L:L;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Intervention astreinte nuit" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!M:M;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Heures à 100%" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!N:N;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Heures à 110%" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!O:O;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)+SOMME.SI.ENS(Variables!S:S;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Heures à 125%" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!P:P;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)+SOMME.SI.ENS(Variables!Q:Q;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)+SOMME.SI.ENS(Variables!T:T;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eh) = "Heures à 150%" Then
Cells(t2eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!R:R;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
End If
Next
'Automatisation cellule 2ème tableau (haut à droite) éléments en quantité
For t2eq = 15 To 21
If Target.Address = "$R$ & t2eq" Then
Else
If Range("R" & t2eq) = "" Then
Cells(t2eq, 20) = ""
Else
End If
If Range("R" & t2eq) = "Panier jour taxable" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!F:F;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eq) = "Indemnité astreinte dimanche" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!G:G;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eq) = "Indemnité astreinte semaine" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!H:H;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eq) = "Panier jour non taxable" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!U:U;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eq) = "Panier nuit non taxable" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eq) = "Panier nuit taxable" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eq) = "IPCM non taxable" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
If Range("R" & t2eq) = "IPCM taxable" Then
Cells(t2eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;N5;Variables!D:D;"">=""&N9;Variables!D:D;""<=""&N10)"
Else
End If
End If
Next
 
 
'Automatisation cellule 3ème tableau (bas à gauche) éléments en heures
For t3eh = 29 To 34
If Target.Address = "$G$ & t3eh" Then
Else
If Range("G" & t3eh) = "" Then
Cells(t3eh, 9) = ""
Else
End If
If Range("G" & t3eh) = "Intervention astreinte jour" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!I:I;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Majoration férié travaillé" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!J:J;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Majoration de dimanche" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!K:K;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Majoration de nuit" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!L:L;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Intervention astreinte nuit" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!M:M;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Heures à 100%" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!N:N;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Heures à 110%" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!O:O;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)+SOMME.SI.ENS(Variables!S:S;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Heures à 125%" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!P:P;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)+SOMME.SI.ENS(Variables!Q:Q;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)+SOMME.SI.ENS(Variables!T:T;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eh) = "Heures à 150%" Then
Cells(t3eh, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!R:R;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
End If
Next
'Automatisation cellule 3ème tableau (bas à gauche) éléments en quantité
For t3eq = 37 To 43
If Target.Address = "$G$ & t3eq" Then
Else
If Range("G" & t3eq) = "" Then
Cells(t3eq, 9) = ""
Else
End If
If Range("G" & t3eq) = "Panier jour taxable" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!F:F;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eq) = "Indemnité astreinte dimanche" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!G:G;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eq) = "Indemnité astreinte semaine" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!H:H;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eq) = "Panier jour non taxable" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!U:U;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eq) = "Panier nuit non taxable" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eq) = "Panier nuit taxable" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eq) = "IPCM non taxable" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
If Range("G" & t3eq) = "IPCM taxable" Then
Cells(t3eq, 9).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;C27;Variables!D:D;"">=""&C31;Variables!D:D;""<=""&C32)"
Else
End If
End If
Next
 
 
'Automatisation cellule 4ème tableau (bas à droite) éléments en heures
For t4eh = 29 To 34
If Target.Address = "$R$ & t4eh" Then
Else
If Range("R" & t4eh) = "" Then
Cells(t4eh, 20) = ""
Else
End If
If Range("R" & t4eh) = "Intervention astreinte jour" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!I:I;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Majoration férié travaillé" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!J:J;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Majoration de dimanche" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!K:K;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Majoration de nuit" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!L:L;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Intervention astreinte nuit" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!M:M;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Heures à 100%" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!N:N;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Heures à 110%" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!O:O;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)+SOMME.SI.ENS(Variables!S:S;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Heures à 125%" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!P:P;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)+SOMME.SI.ENS(Variables!Q:Q;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)+SOMME.SI.ENS(Variables!T:T;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eh) = "Heures à 150%" Then
Cells(t4eh, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!R:R;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
End If
Next
'Automatisation cellule 3ème tableau (bas à gauche) éléments en quantité
For t4eq = 37 To 43
If Target.Address = "$G$ & t4eq" Then
Else
If Range("R" & t4eq) = "" Then
Cells(t4eq, 20) = ""
Else
End If
If Range("R" & t4eq) = "Panier jour taxable" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!F:F;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eq) = "Indemnité astreinte dimanche" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!G:G;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eq) = "Indemnité astreinte semaine" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!H:H;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eq) = "Panier jour non taxable" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!U:U;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eq) = "Panier nuit non taxable" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eq) = "Panier nuit taxable" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!V:V;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eq) = "IPCM non taxable" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
If Range("R" & t4eq) = "IPCM taxable" Then
Cells(t4eq, 20).FormulaLocal = "=SOMME.SI.ENS(Variables!W:W;Variables!A:A;N27;Variables!D:D;"">=""&N31;Variables!D:D;""<=""&N32)"
Else
End If
End If
Next
End Sub
Dans ma ligne de codes, j'ai donc 4 fois la même chose sauf que les cellules changent en fonction de l'un de ses 4 tableaux.
tableau 1 codes de la ligne 12 à 99
tableau 2 codes de la ligne 102 à 189
tableau 3 codes de la ligne 192 à 279
tableau 4 codes de la ligne 282 à 369

Avec une boucle comment je pourrais faire pour avoir que lignes 12 à 99 mais que cela se reproduise sur les 3 autres tableaux automatiquement avec des variables au départ bien placé et bien défini dans la macro.