Bonjour,
j'ai un petit problème de boucles et je n'arrive pas à savoir pourquoi...
J'ai toujours droit à Pas de Next sans For (alors que mon For est bien la) et si j'enlève le Next, j'ai le droit a il faut un blonc end if.....
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 Sub Graphique() Dim Compteur As Integer Dim Cel As Range Dim i As Integer Set Cel = Worksheets("Vue_generale").Range("K1") Compteur = 1 While Cel.Offset(Compteur) <> "" Compteur = Compteur + 1 Wend DestructionUn = 0 DestructionDeux = 0 DestructionTrois = 0 DestructionQuatre = 0 ValorisationUn = 0 ValorisationDeux = 0 ValorisationTrois = 0 ValorisationQuatre = 0 For i = 1 To Compteur If Cel.Offset(i) = "1" Then If Left(Cel.Offset(i), 1) = "D" Then DestructionUn = DestructionUn + Cel.Offset(i, -2) Else ValorisationUn = ValorisationUn + Cel.Offset(i, -2) End If If Cel.Offset(i) = "2" Then If Left(Cel.Offset(i), 1) = "D" Then DestructionDeux = DestructionDeux + Cel.Offset(i, -2) Else ValorisationDeux = ValorisationDeux + Cel.Offset(i, -2) End If If Cel.Offset(i) = "3" Then If Left(Cel.Offset(i), 1) = "D" Then DestructionTrois = DestructionTrois + Cel.Offset(i, -2) Else ValorisationTrois = ValorisationTrois + Cel.Offset(i, -2) End If If Cel.Offset(i) = "4" Then If Left(Cel.Offset(i), 1) = "D" Then DestructionQuatre = DestructionQuatre + Cel.Offset(i, -2) Else ValorisationQuatre = ValorisationQuatre + Cel.Offset(i, -2) End If End If Next i Worksheets("Graphique").Select Range("B8") = DestructionUn '.... End Sub![]()
Partager