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 16/08/2011, 11h06   #1
Invité de passage
 
Inscription : août 2011
Messages : 3
Détails du profil
Informations forums :
Inscription : août 2011
Messages : 3
Points : 1
Points : 1
Par défaut Problème d'incrémentation de variable

Bonjour,

dans le code suivant je rencontre un problème, en effet après divers test je me rend compte que ma variable compteur passe à la valeur de Total avant de faire les test des checkbox, quelqu'un à une idée ?

Merci d'avance :p

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
For Compteur = 2 To Total
    If ComboBox1.Value = Cells(Compteur, 1).Value Then
        Label2.Caption = Cells(Compteur, 4).Value
        Label3.Caption = Cells(Compteur, 5).Value
        Label4.Caption = Cells(Compteur, 6).Value
        Label5.Caption = Cells(Compteur, 7).Value
        Label6.Caption = Cells(Compteur, 8).Value
        Label7.Caption = Cells(Compteur, 9).Value
        Label8.Caption = Cells(Compteur, 10).Value
        ComboBox2.Enabled = True
        ComboBox2.Value = Cells(Compteur, 13).Value
 
        ' Commentaire
 
        If Cells(Compteur, 11).Value = "1" Then
            CheckBox1.Value = True
        End If
        If Cells(Compteur, 12).Value = "1" Then
            CheckBox2.Value = True
        End If
    End If
Next Compteur
Sanegone67 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2011, 11h33   #2
Expert Confirmé
 
Philippe Tulliez
Développeur et formateur VBA, Excel et Word.
Inscription : janvier 2010
Messages : 1 306
Détails du profil
Informations personnelles :
Nom : Philippe Tulliez
Localisation : Belgique

Informations professionnelles :
Activité : Développeur et formateur VBA, Excel et Word.

Informations forums :
Inscription : janvier 2010
Messages : 1 306
Points : 2 654
Points : 2 654
Bonjour,
A première lecture de ton code, je constate que la variable Compteur, que pour ma part j'aurais mommé ligne ou Row parce-que plus proche de la réalité, ne s'incrémente qu'à la seule condition que :
ComboBox1.Value = Cells(Compteur, 1).Value.
Je crois que tu peux en tirer les conclusions toi-même.
En scindant les procédures tu verrais beaucoup plus clair.
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
For Compteur = 2 To Total
    If ComboBox1.Value = Cells(Compteur, 1).Value Then
      AlimenteCombo
      If Cells(Compteur, 11).Value = "1" Then
        CheckBox1.Value = True
      End If
      If Cells(Compteur, 12).Value = "1" Then
        CheckBox2.Value = True
      End If
    End If
Next Compteur
..........................
Sub AlimenteCombo()
  Label2.Caption = Cells(Compteur, 4).Value
  Label3.Caption = Cells(Compteur, 5).Value
  Label4.Caption = Cells(Compteur, 6).Value
  Label5.Caption = Cells(Compteur, 7).Value
  Label6.Caption = Cells(Compteur, 8).Value
  Label7.Caption = Cells(Compteur, 9).Value
  Label8.Caption = Cells(Compteur, 10).Value
  ComboBox2.Enabled = True
  ComboBox2.Value = Cells(Compteur, 13).Value
  ' Commentaire
End Sub
Le nom de procédure AlimenteCombo est totalement farfelue mais ne sert qu'à l' illustration de la réponse.
[EDIT] Attention que je n'ai pas tester le code de ma réponse
[EDIT2] Je viens de voir une petite erreur dans mon intervention si compteur n'est pas déclarée en début de module, elle ne sera évidemment pas reconnue dans le module
AlimenteCombo à laquelle il faudra éventuellement ajouter un argument.
Petite suggestion. Test ta procédure au pas à pas (Touche F8) avec en sus, un petit espion sur la variable Compteur et tu verras tout de suite où est le problème.
__________________
Philippe Tulliez
http://philippe.tulliez.be
Ce que l'on conçoit bien s'énonce clairement, et les mots pour le dire arrivent aisément. (Nicolas Boileau)

Lorsque vous avez la réponse à votre question, n'oubliez pas de cliquer sur et si celle-ci est pertinente pensez à voter
corona est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2011, 12h31   #3
Invité de passage
 
Inscription : août 2011
Messages : 3
Détails du profil
Informations forums :
Inscription : août 2011
Messages : 3
Points : 1
Points : 1
Je suis pas un As mais j'ai pensé au pas à pas mais en mettant des MsgBox ^^

Compteur n'ai pas parlant mais dans la totalité de mon code j'ai besoin d'une variable qui "compte" du coup j'ai créé compteur dans un module pour l'utilisé partout, le code ayant pas pour but d'etre partagé ou repris j'ai juger que c'etait assez parlant pour moi pour le laisser :p

Dans tout les cas je vais testé ce que tu me conseil et merci pour la forme c'est très pédagogue pour un lecteur débutant en dev :p

EDIT :

Après test avec la méthode que tu me donnes mon dernier problème viens du fait que je change la valeur du checkbox cependant cette action ( coché le checkbox) faites par un autre biais inclus l'appel d'autres procédures.

Est il possible d'empécher cela ?
Sanegone67 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2011, 13h06   #4
Expert Confirmé
 
Philippe Tulliez
Développeur et formateur VBA, Excel et Word.
Inscription : janvier 2010
Messages : 1 306
Détails du profil
Informations personnelles :
Nom : Philippe Tulliez
Localisation : Belgique

Informations professionnelles :
Activité : Développeur et formateur VBA, Excel et Word.

Informations forums :
Inscription : janvier 2010
Messages : 1 306
Points : 2 654
Points : 2 654
Bonjour,
Citation:
Envoyé par Sanegone67 Voir le message
Je suis pas un As mais j'ai pensé au pas à pas mais en mettant des MsgBox
Préfère alors le Debug.Print au MsgBox qui a l'avantage d'afficher ses arguments dans la fenêtre d'exécution et ne ralentit pas ton debogage.
Citation:
Envoyé par Sanegone67 Voir le message
Compteur n'ai pas parlant mais dans la totalité de mon code j'ai besoin d'une variable qui "compte" du coup j'ai créé compteur dans un module pour l'utilisé partout, le code ayant pas pour but d'etre partagé ou repris j'ai juger que c'etait assez parlant pour moi pour le laisser :p
Chacun est libre de nommer ces variables comme il l'entend mais même si tu es le seul à travailler su ton code, il n'est pas certain que dans six mois, tu sauras encore ce que cela veut dire.
Citation:
Envoyé par Sanegone67 Voir le message
EDIT :
Après test avec la méthode que tu me donnes mon dernier problème viens du fait que je change la valeur du checkbox cependant cette action ( coché le checkbox) faites par un autre biais inclus l'appel d'autres procédures.
Est il possible d'empécher cela ?
Sûrement mais je n'ai pas très bien compris. Coché le CheckBox par un autre biais ? Quel biais et quelle autres procédures sont appelées ?
Même si je me surprends à deviner bien des choses, un dépôt de ton code ne serait pas un luxe inutile.
__________________
Philippe Tulliez
http://philippe.tulliez.be
Ce que l'on conçoit bien s'énonce clairement, et les mots pour le dire arrivent aisément. (Nicolas Boileau)

Lorsque vous avez la réponse à votre question, n'oubliez pas de cliquer sur et si celle-ci est pertinente pensez à voter
corona est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2011, 13h57   #5
Invité de passage
 
Inscription : août 2011
Messages : 3
Détails du profil
Informations forums :
Inscription : août 2011
Messages : 3
Points : 1
Points : 1
J'ai réussi à contourner mon problème en faisant vérifié une variable :p

Au cas ou ça t'interesse de voir le tout je vais coller tout le code, j'ai pas de problèmes à le partager par contre attention, c'est fait par un mec qui as jamais fait de VB donc ça risque de piqué les yeux à pas mal de monde x)

But du logiciel : Gérer la distributions de récompenses dans un jeu, medailles d'or et d'argent selon plusieurs arguments :


Module 1 ( la par contre tu va voir des noms de variable qui veulent rien dire ^^ )
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
Public STotaljoueur As Integer
Public Compteur As Integer
Public Compteur2 As Integer
Public Compteur3 As Integer
Public Totaljoueur As Integer
Public TauxNormalOr As Integer
Public TauxNormalArgent As Integer
Public TauxMissionOr As Integer
Public TauxMissionArgent As Integer
Public TauxTransfoOr As Integer
Public TauxTransfoArgent As Integer
Public PrioriteNormale As Integer
Public PrioriteMission As Integer
Public PrioriteTransfo As Integer
Public MaxOr As Integer
Public MaxArgent As Integer
Public AjoutOr As Integer
Public AjoutArgent As Integer
Public ResteOr As Integer
Public ResteArgent As Integer
Public TotalOr As Integer
Public TotalArgent As Integer
Public pseudo As String
Public legion As String
Public debile As Integer
Public debile2 As Integer
Public totallegion As Integer
Public E1 As Integer
Public E2 As Integer
Public E3 As Integer
Public tableaupresence(9999) As String
Public tableaupresencenormale(9999, 5) As String
Public tableaupresenceMission(9999, 5) As String
Public tableaupresenceTransfo(9999, 5) As String
Public tableaulegion(9999, 2) As String
Option Explicit
 
Declare Function GetWindowLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
 
 Declare Function SetWindowLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
 
 Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
 
Public Transfer(6) As String
 
Sub OteCroix(UF As UserForm)
Dim hwnd As Long
    'Enlève la croix rouge de l'UF
    hwnd = FindWindowA("Thunder" & IIf(Application.Version Like "8*", "X", "D") _
    & "Frame", UF.Caption)
    SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF
End Sub
Userform1
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
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
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
 
Private Sub BRN_BARRE_JOUEUR_Click()
Unload Me
UserForm4.Show
End Sub
 
Private Sub BTN_BARRE_DISTRIBUTION_Click()
For Totaljoueur = 2 To 10000
    If Cells(Totaljoueur, 1).Value = "" Then
        Exit For
    End If
Next Totaljoueur
Totaljoueur = Totaljoueur - 1
 
' Vérification de la présence
Compteur2 = 1
For Compteur = 2 To Totaljoueur
    If Cells(Compteur, 3).Value = 1 Then
        tableaupresence(Compteur2) = Cells(Compteur, 1).Value
        Compteur2 = Compteur2 + 1
    End If
Next Compteur
 
' tri selon priorite
E1 = 1
E2 = 1
E3 = 1
For Compteur = 1 To Totaljoueur
    For Compteur2 = 2 To Totaljoueur
    If tableaupresence(Compteur) = Cells(Compteur2, 1).Value Then
        If Cells(Compteur2, 2).Value = 1 Then
            tableaupresencenormale(E1, 1) = Cells(Compteur2, 1).Value
            tableaupresencenormale(E1, 2) = Cells(Compteur2, 5).Value
            tableaupresencenormale(E1, 3) = Cells(Compteur2, 6).Value
            tableaupresencenormale(E1, 4) = Cells(Compteur2, 11).Value
            tableaupresencenormale(E1, 5) = Cells(Compteur2, 12).Value
            E1 = E1 + 1
        Else
            If Cells(Compteur2, 2).Value = 2 Then
                tableaupresenceMission(E2, 1) = Cells(Compteur2, 1).Value
                tableaupresenceMission(E2, 2) = Cells(Compteur2, 5).Value
                tableaupresenceMission(E2, 3) = Cells(Compteur2, 6).Value
                tableaupresenceMission(E2, 4) = Cells(Compteur2, 11).Value
                tableaupresenceMission(E2, 5) = Cells(Compteur2, 12).Value
            E2 = E2 + 1
            Else
                If Cells(Compteur2, 2).Value = 3 Then
                    tableaupresenceTransfo(E3, 1) = Cells(Compteur2, 1).Value
                    tableaupresenceTransfo(E3, 2) = Cells(Compteur2, 5).Value
                    tableaupresenceTransfo(E3, 3) = Cells(Compteur2, 6).Value
                    tableaupresenceTransfo(E3, 4) = Cells(Compteur2, 11).Value
                    tableaupresenceTransfo(E3, 5) = Cells(Compteur2, 12).Value
                    E3 = E3 + 1
                 End If
            End If
        End If
    End If
    Next Compteur2
Next Compteur
 
'tri selon besoins
 
For Compteur = 1 To Totaljoueur
        If tableaupresenceTransfo(Compteur, 4) = "1" Then
            tableaupresenceTransfo(Compteur, 2) = 0
        End If
        If tableaupresenceTransfo(Compteur, 5) = "1" Then
            tableaupresenceTransfo(Compteur, 3) = 0
        End If
Next Compteur
 
For Compteur = 1 To Totaljoueur
        If tableaupresenceMission(Compteur, 4) = "1" Then
            tableaupresenceMission(Compteur, 2) = 0
        End If
        If tableaupresenceMission(Compteur, 5) = "1" Then
            tableaupresenceMission(Compteur, 3) = 0
        End If
Next Compteur
 
For Compteur = 1 To Totaljoueur
        If tableaupresencenormale(Compteur, 4) = "1" Then
            tableaupresencenormale(Compteur, 2) = 0
        End If
        If tableaupresencenormale(Compteur, 5) = "1" Then
            tableaupresencenormale(Compteur, 3) = 0
        End If
Next Compteur
 
Compteur3 = 1
For Compteur = 1 To Totaljoueur
    For Compteur2 = 2 To Totaljoueur
        If Cells(Compteur2, 1).Value = tableaupresenceTransfo(Compteur, 1) Then
            If TotalOr + tableaupresenceTransfo(Compteur, 2) > 0 Then
                If tableaupresenceTransfo(Compteur, 2) < MaxOr Then
                    Cells(Compteur3, 34).Value = tableaupresenceTransfo(Compteur, 1)
                    Cells(Compteur3, 35).Value = tableaupresenceTransfo(Compteur, 2)
                    Compteur3 = Compteur3 + 1
                    TotalOr = TotalOr - tableaupresenceTransfo(Compteur, 2)
                    tableaupresenceTransfo(Compteur, 2) = 0
                Else
                    If tableaupresenceTransfo(Compteur, 2) = MaxOr Then
                        Cells(Compteur3, 34).Value = tableaupresenceTransfo(Compteur, 1)
                        Cells(Compteur3, 35).Value = tableaupresenceTransfo(Compteur, 2)
                        Compteur3 = Compteur3 + 1
                        tableaupresenceTransfo(Compteur, 2) = 0
                        TotalOr = TotalOr - MaxOr
                    Else
                        If tableaupresenceTransfo(Compteur, 2) > MaxOr Then
                            Cells(Compteur3, 34).Value = tableaupresenceTransfo(Compteur, 1)
                            Cells(Compteur3, 35).Value = MaxOr
                            Compteur3 = Compteur3 + 1
                            tableaupresenceTransfo(Compteur, 2) = tableaupresenceTransfo(Compteur, 2) - MaxOr
                            TotalOr = TotalOr - MaxOr
                        End If
                    End If
                End If
            End If
        End If
    Next Compteur2
Next Compteur
 
For Compteur = 1 To Totaljoueur
    For Compteur2 = 2 To Totaljoueur
        If Cells(Compteur2, 1).Value = tableaupresenceMission(Compteur, 1) Then
            If TotalOr + tableaupresenceMission(Compteur, 2) > 0 Then
                If tableaupresenceMission(Compteur, 2) < MaxOr Then
                    Cells(Compteur3, 34).Value = tableaupresenceMission(Compteur, 1)
                    Cells(Compteur3, 35).Value = tableaupresenceMission(Compteur, 2)
                    Compteur3 = Compteur3 + 1
                    TotalOr = TotalOr - tableaupresenceMission(Compteur, 2)
                    tableaupresenceMission(Compteur, 2) = 0
                Else
                    If tableaupresenceMission(Compteur, 2) = MaxOr Then
                        Cells(Compteur3, 34).Value = tableaupresenceMission(Compteur, 1)
                        Cells(Compteur3, 35).Value = tableaupresenceMission(Compteur, 2)
                        Compteur3 = Compteur3 + 1
                        tableaupresenceMission(Compteur, 2) = 0
                        TotalOr = TotalOr - MaxOr
                    Else
                        If tableaupresenceMission(Compteur, 2) > MaxOr Then
                            Cells(Compteur3, 34).Value = tableaupresenceMission(Compteur, 1)
                            Cells(Compteur3, 35).Value = MaxOr
                            Compteur3 = Compteur3 + 1
                            tableaupresenceMission(Compteur, 2) = tableaupresenceMission(Compteur, 2) - MaxOr
                            TotalOr = TotalOr - MaxOr
                        End If
                    End If
                End If
            End If
        End If
    Next Compteur2
Next Compteur
 
For Compteur = 1 To Totaljoueur
    For Compteur2 = 2 To Totaljoueur
        If Cells(Compteur2, 1).Value = tableaupresencenormale(Compteur, 1) Then
            If TotalOr - tableaupresencenormale(Compteur, 2) > 0 Then
                If tableaupresencenormale(Compteur, 2) < MaxOr Then
                    Cells(Compteur3, 34).Value = tableaupresencenormale(Compteur, 1)
                    Cells(Compteur3, 35).Value = tableaupresencenormale(Compteur, 2)
                    Compteur3 = Compteur3 + 1
                    TotalOr = TotalOr - tableaupresencenormale(Compteur, 2)
                    tableaupresencenormale(Compteur, 2) = 0
                Else
                    If tableaupresencenormale(Compteur, 2) = MaxOr Then
                        Cells(Compteur3, 34).Value = tableaupresencenormale(Compteur, 1)
                        Cells(Compteur3, 35).Value = tableaupresencenormale(Compteur, 2)
                        Compteur3 = Compteur3 + 1
                        tableaupresencenormale(Compteur, 2) = 0
                        TotalOr = TotalOr - MaxOr
                    Else
                        If tableaupresencenormale(Compteur, 2) > MaxOr Then
                            Cells(Compteur3, 34).Value = tableaupresencenormale(Compteur, 1)
                            Cells(Compteur3, 35).Value = MaxOr
                            Compteur3 = Compteur3 + 1
                            tableaupresencenormale(Compteur, 2) = tableaupresencenormale(Compteur, 2) - MaxOr
                            TotalOr = TotalOr - MaxOr
                        End If
                    End If
                End If
            End If
        End If
    Next Compteur2
Next Compteur
 
For Compteur = 1 To Totaljoueur
    For Compteur2 = 2 To Totaljoueur
        If Cells(Compteur2, 1).Value = tableaupresenceTransfo(Compteur, 1) Then
            If TotalArgent - tableaupresenceTransfo(Compteur, 3) > 0 Then
                If tableaupresenceTransfo(Compteur, 3) < MaxArgent Then
                    For Compteur3 = 1 To Totaljoueur
                        If Cells(Compteur3, 34).Value = tableaupresenceTransfo(Compteur, 1) Then
                            Cells(Compteur3, 36).Value = tableaupresenceTransfo(Compteur, 3)
                            TotalArgent = TotalArgent - tableaupresenceTransfo(Compteur, 3)
                            tableaupresenceTransfo(Compteur, 3) = 0
                        End If
                    Next Compteur3
                Else
                    If tableaupresenceTransfo(Compteur, 2) = MaxArgent Then
                        For Compteur3 = 1 To Totaljoueur
                            If Cells(Compteur3, 34).Value = tableaupresenceTransfo(Compteur, 1) Then
                                Cells(Compteur3, 36).Value = tableaupresenceTransfo(Compteur, 3)
                                TotalArgent = TotalArgent - MaxArgent
                                tableaupresenceTransfo(Compteur, 3) = 0
                            End If
                        Next Compteur3
                    Else
                        If tableaupresenceTransfo(Compteur, 2) > MaxArgent Then
                            For Compteur3 = 1 To Totaljoueur
                                If Cells(Compteur3, 34).Value = tableaupresenceTransfo(Compteur, 1) Then
                                    Cells(Compteur3, 36).Value = MaxArgent
                                    TotalArgent = TotalArgent - MaxArgent
                                    tableaupresenceTransfo(Compteur, 3) = tableaupresenceTransfo(Compteur, 3) - MaxArgent
                                End If
                            Next Compteur3
                        End If
                    End If
                End If
            End If
        End If
    Next Compteur2
Next Compteur
 
For Compteur = 1 To Totaljoueur
    For Compteur2 = 2 To Totaljoueur
        If Cells(Compteur2, 1).Value = tableaupresenceMission(Compteur, 1) Then
            If TotalArgent - tableaupresenceMission(Compteur, 3) > 0 Then
                If tableaupresenceMission(Compteur, 3) < MaxArgent Then
                    For Compteur3 = 1 To Totaljoueur
                        If Cells(Compteur3, 34).Value = tableaupresenceMission(Compteur, 1) Then
                            Cells(Compteur3, 36).Value = tableaupresenceMission(Compteur, 3)
                            TotalArgent = TotalArgent - tableaupresenceMission(Compteur, 3)
                            tableaupresenceMission(Compteur, 3) = 0
                        End If
                    Next Compteur3
                Else
                    If tableaupresenceMission(Compteur, 2) = MaxArgent Then
                        For Compteur3 = 1 To Totaljoueur
                            If Cells(Compteur3, 34).Value = tableaupresenceMission(Compteur, 1) Then
                                Cells(Compteur3, 36).Value = tableaupresenceMission(Compteur, 3)
                                TotalArgent = TotalArgent - MaxArgent
                                tableaupresenceMission(Compteur, 3) = 0
                            End If
                        Next Compteur3
                    Else
                        If tableaupresenceMission(Compteur, 2) > MaxArgent Then
                            For Compteur3 = 1 To Totaljoueur
                                If Cells(Compteur3, 34).Value = tableaupresenceMission(Compteur, 1) Then
                                    Cells(Compteur3, 36).Value = MaxArgent
                                    TotalArgent = TotalArgent - MaxArgent
                                    tableaupresenceMission(Compteur, 3) = tableaupresenceMission(Compteur, 3) - MaxArgent
                                End If
                            Next Compteur3
                        End If
                    End If
                End If
            End If
        End If
    Next Compteur2
Next Compteur
 
For Compteur = 1 To Totaljoueur
    For Compteur2 = 2 To Totaljoueur
        If Cells(Compteur2, 1).Value = tableaupresencenormale(Compteur, 1) Then
            If TotalArgent - tableaupresencenormale(Compteur, 3) > 0 Then
                If tableaupresencenormale(Compteur, 3) < MaxArgent Then
                    For Compteur3 = 2 To Totaljoueur
                        If Cells(Compteur3, 34).Value = tableaupresencenormale(Compteur, 1) Then
                            Cells(Compteur3, 36).Value = tableaupresencenormale(Compteur, 3)
                            TotalArgent = TotalArgent - tableaupresencenormale(Compteur, 3)
                            tableaupresencenormale(Compteur, 3) = 0
                        End If
                    Next Compteur3
                Else
                    If tableaupresencenormale(Compteur, 2) = MaxOr Then
                        For Compteur3 = 1 To Totaljoueur
                            If Cells(Compteur3, 34).Value = tableaupresencenormale(Compteur, 1) Then
                                Cells(Compteur3, 36).Value = tableaupresencenormale(Compteur, 3)
                                TotalArgent = TotalArgent - MaxArgent
                                tableaupresencenormale(Compteur, 3) = 0
                            End If
                        Next Compteur3
                    Else
                        If tableaupresencenormale(Compteur, 2) > MaxOr Then
                            For Compteur3 = 1 To Totaljoueur
                                If Cells(Compteur3, 34).Value = tableaupresencenormale(Compteur, 1) Then
                                    Cells(Compteur3, 36).Value = MaxArgent
                                    TotalArgent = TotalArgent - MaxArgent
                                    tableaupresencenormale(Compteur, 3) = tableaupresencenormale(Compteur, 3) - MaxArgent
                                End If
                            Next Compteur3
                        End If
                    End If
                End If
            End If
        End If
    Next Compteur2
Next Compteur
For Compteur = 1 To 9999
    For Compteur2 = 0 To 4
        tableaupresence(Compteur) = ""
        tableaupresencenormale(Compteur, Compteur2) = ""
        tableaupresenceMission(Compteur, Compteur2) = ""
        tableaupresenceTransfo(Compteur, Compteur2) = ""
    Next Compteur2
Next Compteur
 
Cells(2, 27).Value = 0
AjoutOr = 0
Cells(2, 28).Value = 0
AjoutArgent = 0
Cells(2, 29).Value = TotalOr
ResteOr = TotalOr
Cells(2, 30).Value = TotalArgent
ResteArgent = TotalArgent
Cells(2, 31).Value = 0
TotalOr = 0
Cells(2, 32).Value = 0
TotalArgent = 0
 
For Compteur = 1 To Totaljoueur
    For Compteur2 = 1 To Totaljoueur
        If Cells(Compteur, 34).Value = Cells(Compteur2, 1).Value Then
            Cells(Compteur2, 5).Value = Cells(Compteur2, 5).Value - Cells(Compteur, 35).Value
            Cells(Compteur2, 6).Value = Cells(Compteur2, 6).Value - Cells(Compteur, 36).Value
            Cells(Compteur2, 3).Value = 0
            Cells(Compteur, 35).Value = ""
            Cells(Compteur, 36).Value = ""
            Cells(Compteur, 34).Value = ""
        End If
    Next Compteur2
Next Compteur
 
For Compteur = 2 To Totaljoueur
    If Cells(Compteur, 3).Value = 1 Then
        Cells(Compteur, 2).Value = 3
        Cells(Compteur, 3).Value = 0
    End If
Next Compteur
 
Unload Me
UserForm3.Show
End Sub
 
Private Sub BTN_BARRE_QUITTER_Click()
Unload Me
End Sub
 
Private Sub BTN_BARRE_RESET_Click()
Unload Me
UserForm5.Show
End Sub
 
Private Sub BTN_BARRE_TAUX_Click()
Unload Me
UserForm2.Show
End Sub
 
Private Sub CommandButton1_Click()
For Compteur = 2 To Totaljoueur + 1
    If Cells(Compteur, 1).Value = ComboBox1.Value Then
        If Cells(Compteur, 2).Value = 3 Then
        Else
            Cells(Compteur, 2).Value = PrioriteNormale
        End If
        Cells(Compteur, 3).Value = 1
        Cells(Compteur, 4).Value = Cells(Compteur, 4).Value + 1
        Cells(Compteur, 5).Value = Cells(Compteur, 5).Value + TauxNormalOr
        Cells(Compteur, 6).Value = Cells(Compteur, 6).Value + TauxNormalArgent
        Cells(Compteur, 7).Value = Cells(Compteur, 7).Value + TauxNormalOr
        Cells(Compteur, 8).Value = Cells(Compteur, 8).Value + TauxNormalArgent
        Cells(Compteur, 9).Value = Cells(Compteur, 9).Value
        Cells(Compteur, 10).Value = Cells(Compteur, 10).Value
        Exit For
    Else
        If Cells(Compteur, 1).Value = "" Then
            Cells(Compteur, 1).Value = ComboBox1.Value
            If Cells(Compteur, 2).Value = 3 Then
            Else
                Cells(Compteur, 2).Value = PrioriteNormale
            End If
            Cells(Compteur, 3).Value = 1
            Cells(Compteur, 4).Value = Cells(Compteur, 4).Value + 1
            Cells(Compteur, 5).Value = Cells(Compteur, 5).Value + TauxNormalOr
            Cells(Compteur, 6).Value = Cells(Compteur, 6).Value + TauxNormalArgent
            Cells(Compteur, 7).Value = Cells(Compteur, 7).Value + TauxNormalOr
            Cells(Compteur, 8).Value = Cells(Compteur, 8).Value + TauxNormalArgent
            Cells(Compteur, 9).Value = Cells(Compteur, 9).Value
            Cells(Compteur, 10).Value = Cells(Compteur, 10).Value
            Cells(Compteur, 11).Value = 0
            Cells(Compteur, 12).Value = 0
            Cells(Compteur, 13).Value = ComboBox4.Value
 
            For totallegion = 2 To 10000
                If Cells(totallegion, 1).Value = "" Then
                    Exit For
                End If
            Next totallegion
            totallegion = totallegion - 1
            If totallegion < 2 Then
                totallegion = 2
            End If
            For Compteur2 = 2 To totallegion
                If ComboBox4.Value = Cells(Compteur2, 14).Value Then
                    Exit For
                Else
                    If ComboBox4.Value = "" Then
                        Exit For
                    Else
                        If Cells(Compteur2, 14).Value = "" Then
                            Cells(Compteur2, 14).Value = ComboBox4.Value
                            Exit For
                        End If
                    End If
                End If
            Next Compteur2
 
 
            Totaljoueur = Totaljoueur + 1
        End If
    End If
Next Compteur
ComboBox1.Value = ""
End Sub
 
Private Sub CommandButton2_Click()
For Compteur = 2 To Totaljoueur + 1
    If Cells(Compteur, 1).Value = ComboBox2.Value Then
        If Cells(Compteur, 2).Value = 3 Then
        Else
            Cells(Compteur, 2).Value = PrioriteMission
        End If
        Cells(Compteur, 2).Value = PrioriteMission
        Cells(Compteur, 3).Value = 1
        Cells(Compteur, 4).Value = Cells(Compteur, 4).Value + 1
        Cells(Compteur, 5).Value = Cells(Compteur, 5).Value + TauxMissionOr
        Cells(Compteur, 6).Value = Cells(Compteur, 6).Value + TauxMissionArgent
        Cells(Compteur, 7).Value = Cells(Compteur, 7).Value + TauxMissionOr
        Cells(Compteur, 8).Value = Cells(Compteur, 8).Value + TauxMissionArgent
        Cells(Compteur, 9).Value = Cells(Compteur, 9).Value + 1
        Cells(Compteur, 10).Value = Cells(Compteur, 10).Value
        Exit For
    Else
        If Cells(Compteur, 1).Value = "" Then
            Cells(Compteur, 1).Value = ComboBox2.Value
            If Cells(Compteur, 2).Value = 3 Then
            Else
                Cells(Compteur, 2).Value = PrioriteMission
            End If
            Cells(Compteur, 3).Value = 1
            Cells(Compteur, 4).Value = Cells(Compteur, 4).Value + 1
            Cells(Compteur, 5).Value = Cells(Compteur, 5).Value + TauxMissionOr
            Cells(Compteur, 6).Value = Cells(Compteur, 6).Value + TauxMissionArgent
            Cells(Compteur, 7).Value = Cells(Compteur, 7).Value + TauxMissionOr
            Cells(Compteur, 8).Value = Cells(Compteur, 8).Value + TauxMissionArgent
            Cells(Compteur, 9).Value = Cells(Compteur, 9).Value + 1
            Cells(Compteur, 10).Value = Cells(Compteur, 10).Value
            Cells(Compteur, 11).Value = 0
            Cells(Compteur, 12).Value = 0
            Cells(Compteur, 13).Value = ComboBox5.Value
 
            For totallegion = 2 To 10000
                If Cells(totallegion, 1).Value = "" Then
                    Exit For
                End If
            Next totallegion
            totallegion = totallegion - 1
            If totallegion < 2 Then
                totallegion = 2
            End If
            For Compteur2 = 2 To totallegion
                If ComboBox5.Value = Cells(Compteur2, 14).Value Then
                    Exit For
                Else
                    If ComboBox5.Value = "" Then
                        Exit For
                    Else
                        If Cells(Compteur2, 14).Value = "" Then
                            Cells(Compteur2, 14).Value = ComboBox5.Value
                            Exit For
                        End If
                    End If
                End If
            Next Compteur2
            Totaljoueur = Totaljoueur + 1
        End If
    End If
Next Compteur
ComboBox2.Value = ""
End Sub
 
Private Sub CommandButton3_Click()
For Compteur = 2 To Totaljoueur + 1
    If Cells(Compteur, 1).Value = ComboBox3.Value Then
        If Cells(Compteur, 2).Value = 3 Then
        Else
            Cells(Compteur, 2).Value = PrioriteTransfo
        End If
        Cells(Compteur, 3).Value = 1
        Cells(Compteur, 4).Value = Cells(Compteur, 4).Value + 1
        Cells(Compteur, 5).Value = TauxTransfoOr
        Cells(Compteur, 6).Value = TauxTransfoArgent
        Cells(Compteur, 7).Value = Cells(Compteur, 7).Value + TauxTransfoOr
        Cells(Compteur, 8).Value = Cells(Compteur, 8).Value + TauxTransfoArgent
        Cells(Compteur, 9).Value = Cells(Compteur, 9).Value
        Cells(Compteur, 10).Value = Cells(Compteur, 10).Value + 1
        Exit For
    Else
        If Cells(Compteur, 1).Value = "" Then
            Cells(Compteur, 1).Value = ComboBox3.Value
            If Cells(Compteur, 2).Value = 3 Then
            Else
                Cells(Compteur, 2).Value = PrioriteTransfo
            End If
            Cells(Compteur, 3).Value = 1
            Cells(Compteur, 4).Value = Cells(Compteur, 4).Value + 1
            Cells(Compteur, 5).Value = Cells(Compteur, 6).Value + TauxTransfoOr
            Cells(Compteur, 6).Value = Cells(Compteur, 6).Value + TauxTransfoArgent
            Cells(Compteur, 7).Value = Cells(Compteur, 7).Value + TauxTransfoOr
            Cells(Compteur, 8).Value = Cells(Compteur, 8).Value + TauxTransfoArgent
            Cells(Compteur, 9).Value = Cells(Compteur, 9).Value
            Cells(Compteur, 10).Value = Cells(Compteur, 10).Value + 1
            Cells(Compteur, 11).Value = 0
            Cells(Compteur, 12).Value = 0
            Cells(Compteur, 13).Value = ComboBox6.Value
            For totallegion = 2 To 10000
                If Cells(totallegion, 1).Value = "" Then
                    Exit For
                End If
            Next totallegion
            totallegion = totallegion - 1
            If totallegion < 2 Then
                totallegion = 2
            End If
            For Compteur2 = 2 To totallegion
                If ComboBox6.Value = Cells(Compteur2, 14).Value Then
                    Exit For
                Else
                    If ComboBox6.Value = "" Then
                        Exit For
                    Else
                        If Cells(Compteur2, 14).Value = "" Then
                            Cells(Compteur2, 14).Value = ComboBox6.Value
                            Exit For
                        End If
                    End If
                End If
            Next Compteur2
 
            Totaljoueur = Totaljoueur + 1
        End If
    End If
Next Compteur
ComboBox3.Value = ""
 
End Sub
 
Private Sub CommandButton4_Click()
For Compteur = 2 To Totaljoueur
    If Cells(Compteur, 1).Value = ComboBox7.Value Then
        Cells(Compteur, 1).Value = TextBox7.Value
    End If
Next Compteur
End Sub
 
Private Sub CommandButton5_Click()
legion = ComboBox9.Value
For Compteur = 2 To Totaljoueur
    If Cells(Compteur, 13).Value = legion Then
        Cells(Compteur, 13).Value = TextBox8.Value
    End If
Next Compteur
For Compteur = 2 To Totaljoueur
    If Cells(Compteur, 14).Value = legion Then
        Cells(Compteur, 14).Value = TextBox8.Value
    End If
Next Compteur
End Sub
 
Private Sub TextBox1_Change()
If TextBox1.Value = "" Then
    TextBox1.Value = 0
End If
AjoutOr = TextBox1.Value
Cells(2, 27).Value = AjoutOr
Cells(2, 31).Value = AjoutOr + ResteOr
TotalOr = AjoutOr + ResteOr
TextBox5.Value = TotalOr
End Sub
 
Private Sub TextBox2_Change()
If TextBox2.Value = "" Then
    TextBox2.Value = 0
End If
AjoutArgent = TextBox2.Value
Cells(2, 28).Value = AjoutArgent
Cells(2, 32).Value = AjoutArgent + ResteArgent
TotalArgent = AjoutArgent + ResteArgent
TextBox6.Value = TotalArgent
End Sub
 
Private Sub TextBox3_Change()
If TextBox3.Value = "" Then
    TextBox3.Value = 0
End If
ResteOr = TextBox3.Value
Cells(2, 29).Value = ResteOr
Cells(2, 31).Value = AjoutOr + ResteOr
TotalOr = AjoutOr + ResteOr
TextBox5.Value = TotalOr
End Sub
 
Private Sub TextBox5_Change()
If TextBox5.Value = "" Then
    TextBox5.Value = 0
End If
TextBox5.Value = TotalOr
Cells(2, 31).Value = TotalOr
End Sub
 
Private Sub TextBox6_Change()
If TextBox6.Value = "" Then
    TextBox6.Value = 0
End If
TextBox6.Value = TotalArgent
Cells(2, 32).Value = TotalArgent
End Sub
 
Private Sub Userform_Initialize()
 OteCroix Me
Compteur = 0
Compteur2 = 0
Totaljoueur = 0
MaxOr = Cells(2, 15).Value
MaxArgent = Cells(2, 16).Value
AjoutOr = Cells(2, 27).Value
AjoutArgent = Cells(2, 28).Value
ResteOr = Cells(2, 29).Value
ResteArgent = Cells(2, 30).Value
TotalOr = AjoutOr + ResteOr
TotalArgent = AjoutArgent + ResteArgent
TauxNormalOr = Cells(2, 17).Value
TauxNormalArgent = Cells(2, 18).Value
TauxMissionOr = Cells(2, 19).Value
TauxMissionArgent = Cells(2, 20).Value
TauxTransfoOr = Cells(2, 21).Value
TauxTransfoArgent = Cells(2, 22).Value
PrioriteNormale = Cells(2, 23).Value
PrioriteMission = Cells(2, 24).Value
PrioriteTransfo = Cells(2, 25).Value
TextBox1.Value = Cells(2, 27).Value
TextBox3.Value = Cells(2, 29).Value
TextBox2.Value = Cells(2, 28).Value
TextBox4.Value = Cells(2, 30).Value
TextBox5.Value = TotalOr
TextBox6.Value = TotalArgent
 
For Totaljoueur = 2 To 10000
    If Cells(Totaljoueur, 1).Value = "" Then
        Exit For
    End If
Next Totaljoueur
Totaljoueur = Totaljoueur - 1
 
For totallegion = 2 To 10000
    If Cells(totallegion, 14).Value = "" Then
        Exit For
    End If
Next totallegion
totallegion = totallegion - 1
 
ComboBox1.RowSource = "Feuil1!A2:A" & Totaljoueur
ComboBox2.RowSource = "Feuil1!A2:A" & Totaljoueur
ComboBox3.RowSource = "Feuil1!A2:A" & Totaljoueur
ComboBox4.RowSource = "Feuil1!n2:n" & totallegion
ComboBox5.RowSource = "Feuil1!n2:n" & totallegion
ComboBox6.RowSource = "Feuil1!n2:n" & totallegion
ComboBox7.RowSource = "Feuil1!A2:A" & Totaljoueur
ComboBox9.RowSource = "Feuil1!n2:n" & totallegion
 
End Sub
 
Private Sub TextBox4_Change()
ResteArgent = TextBox4.Value
Cells(2, 30).Value = ResteArgent
Cells(2, 32).Value = AjoutArgent + ResteArgent
TotalArgent = AjoutArgent + ResteArgent
TextBox6.Value = TotalArgent
End Sub
Userform2
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
 
Private Sub BRN_BARRE_JOUEUR_Click()
Unload Me
UserForm4.Show
End Sub
 
Private Sub BTN_BARRE_ACCEUIL_Click()
Unload Me
UserForm1.Show
End Sub
 
Private Sub BTN_BARRE_DISTRIBUTION_Click()
MsgBox ("Utilisable uniquement sur l'acceuil.")
End Sub
 
Private Sub BTN_BARRE_RESET_Click()
Unload Me
UserForm5.Show
End Sub
 
Private Sub CommandButton1_Click()
Cells(2, 15).Value = TextBox1.Value
MaxOr = Cells(2, 15).Value
End Sub
Private Sub CommandButton2_Click()
Cells(2, 16).Value = TextBox2.Value
MaxArgent = Cells(2, 16).Value
End Sub
Private Sub CommandButton3_Click()
Cells(2, 17).Value = TextBox3.Value
TauxNormalOr = Cells(2, 17).Value
End Sub
Private Sub CommandButton4_Click()
Cells(2, 18).Value = TextBox4.Value
TauxNormalArgent = Cells(2, 18).Value
End Sub
Private Sub CommandButton5_Click()
Cells(2, 19).Value = TextBox5.Value
TauxMissionOr = Cells(2, 19).Value
End Sub
Private Sub CommandButton7_Click()
Cells(2, 20).Value = TextBox7.Value
TauxMissionArgent = Cells(2, 20).Value
End Sub
Private Sub CommandButton8_Click()
Cells(2, 21).Value = TextBox8.Value
TauxTransfoOr = Cells(2, 21).Value
End Sub
Private Sub CommandButton9_Click()
Cells(2, 22).Value = TextBox9.Value
TauxTransfoArgent = Cells(2, 22).Value
End Sub
Private Sub CommandButton10_Click()
Cells(2, 23).Value = TextBox10.Value
PrioriteNormale = Cells(2, 23).Value
End Sub
Private Sub CommandButton11_Click()
Cells(2, 24).Value = TextBox11.Value
PrioriteMission = Cells(2, 24).Value
End Sub
Private Sub CommandButton12_Click()
Cells(2, 25).Value = TextBox12.Value
PrioriteTransfo = Cells(2, 25).Value
End Sub
Private Sub Userform_Initialize()
 OteCroix Me
TextBox1.Value = Cells(2, 15).Value
TextBox2.Value = Cells(2, 16).Value
TextBox3.Value = Cells(2, 17).Value
TextBox4.Value = Cells(2, 18).Value
TextBox5.Value = Cells(2, 19).Value
TextBox7.Value = Cells(2, 20).Value
TextBox8.Value = Cells(2, 21).Value
TextBox9.Value = Cells(2, 22).Value
TextBox10.Value = Cells(2, 23).Value
TextBox11.Value = Cells(2, 24).Value
TextBox12.Value = Cells(2, 25).Value
 
End Sub
Userform3
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
 
 
Private Sub Userform_Initialize()
For STotaljoueur = 2 To 10000
    If Cells(STotaljoueur, 34).Value = "" Then
        Exit For
    End If
Next STotaljoueur
 
For Compteur = 1 To STotaljoueur - 1
    If Cells(Compteur, 35).Value = "" Then
        Cells(Compteur, 35).Value = 0
    End If
    If Cells(Compteur, 36).Value = "" Then
        Cells(Compteur, 36).Value = 0
    End If
Next Compteur
 
For Compteur = 1 To STotaljoueur - 1
    Cells(Compteur, 37).Value = Cells(Compteur, 34).Value & " : " & Cells(Compteur, 35).Value & " / " & Cells(Compteur, 36).Value
Next Compteur
ListBox1.RowSource = "Feuil1!Ak1:Ak" & STotaljoueur
End Sub
 
Private Sub BTN_BARRE_ACCEUIL_Click()
Unload Me
UserForm1.Show
End Sub
Userform4
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
 
Private Sub BTN_BARRE_ACCEUIL_Click()
Unload Me
UserForm1.Show
End Sub
 
Private Sub BTN_BARRE_RESET_Click()
Unload Me
UserForm5.Show
End Sub
 
Private Sub BTN_BARRE_TAUX_Click()
Unload Me
UserForm2.Show
End Sub
 
Private Sub CheckBox1_Click()
If debil = 0 Then
    For Compteur = 2 To Totaljoueur
        If ComboBox1.Value = Cells(Compteur, 1).Value Then
            If CheckBox1.Value = True Then
                Cells(Compteur, 11).Value = 1
            Else
                If CheckBox1.Value = False Then
                    Cells(Compteur, 11).Value = 0
                End If
            End If
        End If
    Next Compteur
End If
End Sub
 
Private Sub CheckBox2_Click()
If debil = 0 Then
    For Compteur = 2 To Totaljoueur
        If ComboBox1.Value = Cells(Compteur, 1).Value Then
            If CheckBox2.Value = True Then
                Cells(Compteur, 12).Value = 1
            Else
                If CheckBox2.Value = False Then
                    Cells(Compteur, 12).Value = 0
                End If
            End If
        End If
    Next Compteur
End If
End Sub
 
Private Sub ComboBox1_Change()
For Compteur = 2 To Totaljoueur
    If ComboBox1.Value = Cells(Compteur, 1).Value Then
        debil = 1
        debil2 = Compteur
        If Cells(Compteur, 11).Value = "1" Then
            CheckBox1.Value = True
        Else
            If Cells(Compteur, 11).Value = "0" Then
                CheckBox1.Value = False
            End If
        End If
        Compteur = debil2
        If Cells(Compteur, 12).Value = "1" Then
            CheckBox2.Value = True
        Else
            If Cells(Compteur, 12).Value = "0" Then
                CheckBox2.Value = False
            End If
        End If
        debil = 0
        Label2.Caption = ("Total Présences : " & " " & Cells(Compteur, 4).Value)
        Label3.Caption = ("Points Or actuels:" & " " & Cells(Compteur, 5).Value)
        Label4.Caption = ("Points Argent actuels :" & " " & Cells(Compteur, 6).Value)
        Label5.Caption = ("Total Points Or : " & " " & Cells(Compteur, 7).Value)
        Label6.Caption = ("Total Points Argent : " & " " & Cells(Compteur, 8).Value)
        Label7.Caption = ("Total cohorte mission : " & " " & Cells(Compteur, 9).Value)
        Label8.Caption = ("Total cohorte tranfo : " & " " & Cells(Compteur, 10).Value)
        ComboBox2.Enabled = True
        ComboBox2.Value = Cells(Compteur, 13).Value
    End If
Next Compteur
End Sub
 
Private Sub ComboBox2_Change()
For Compteur = 2 To Totaljoueur
    If ComboBox1.Value = Cells(Compteur, 1).Value Then
        Cells(Compteur, 13).Value = ComboBox2.Value
    End If
Next Compteur
 
End Sub
 
Private Sub Userform_Initialize()
 OteCroix Me
For Totaljoueur = 2 To 10000
    If Cells(Totaljoueur, 1).Value = "" Then
        Exit For
    End If
Next Totaljoueur
Totaljoueur = Totaljoueur - 1
 
For totallegion = 2 To 10000
    If Cells(totallegion, 14).Value = "" Then
        Exit For
    End If
Next totallegion
totallegion = totallegion - 1
 
ComboBox1.RowSource = "Feuil1!A2:A" & Totaljoueur
ComboBox2.RowSource = "Feuil1!n2:n" & totallegion
End Sub

Userform5
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
 
Private Sub BRN_BARRE_JOUEUR_Click()
Unload Me
UserForm4.Show
End Sub
Private Sub BTN_BARRE_ACCEUIL_Click()
Unload Me
UserForm1.Show
End Sub
Private Sub BTN_BARRE_TAUX_Click()
Unload Me
UserForm2.Show
End Sub
Private Sub CommandButton1_Click()
For Compteur = 2 To 1000
    For Compteur2 = 1 To 40
        Cells(Compteur, Compteur2).Value = ""
    Next Compteur2
Next Compteur
End Sub
 
Private Sub Userform_Initialize()
 OteCroix Me
End Sub
Sanegone67 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/08/2011, 14h11   #6
Expert Confirmé
 
Philippe Tulliez
Développeur et formateur VBA, Excel et Word.
Inscription : janvier 2010
Messages : 1 306
Détails du profil
Informations personnelles :
Nom : Philippe Tulliez
Localisation : Belgique

Informations professionnelles :
Activité : Développeur et formateur VBA, Excel et Word.

Informations forums :
Inscription : janvier 2010
Messages : 1 306
Points : 2 654
Points : 2 654
Bonjour,
Citation:
Envoyé par Sanegone67 Voir le message
J'ai réussi à contourner mon problème en faisant vérifié une variable :p
Tant mieux et merci d'avoir signalé ce post comme étant résolu.
Citation:
Envoyé par Sanegone67 Voir le message
Au cas ou ça t'interesse de voir le tout je vais coller tout le code, j'ai pas de problèmes à le partager par contre attention, c'est fait par un mec qui as jamais fait de VB donc ça risque de piqué les yeux à pas mal de monde x)
Ce n'est pas que cela m'intéresse. Le but était de pourvoir comprendre ce qui n'allait pas dans ton code et si ton problème est résolu, le chapitre est clos.
__________________
Philippe Tulliez
http://philippe.tulliez.be
Ce que l'on conçoit bien s'énonce clairement, et les mots pour le dire arrivent aisément. (Nicolas Boileau)

Lorsque vous avez la réponse à votre question, n'oubliez pas de cliquer sur et si celle-ci est pertinente pensez à voter
corona 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 09h18.


 
 
 
 
Partenaires

Hébergement Web