Bonjour, j'ai un problème assez gênant avec une boucle en VBA.
En fait il me signale une erreur de compilation : Boucle sans Do...
Alors que, ben il y est le Do.
La boucle marchait très bien avant, j'ai juste rajouté quelques trucs et depuis il me fait ça.
Plus précisément j'ai seulement rajouté le Range("M" & j).Value = Range("M" & j).Value / 1000 à la fin de la boucle.
J'espère que vous pourrez m'aider.
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 Do While j = i Or Cells(j, 4) = Cells(j - 1, 4) Range("P" & j).FormulaR1C1 = "=RC[-3]*(R1C10/1000)" Range("O" & j).FormulaR1C1 = for1 Range("Q" & j).FormulaR1C1 = "=RC[-3]-RC[-1]" Range("S" & j).FormulaR1C1 = "=IF(RC[-5]=0,0,RC[-2]/RC[-5])" If Range("E" & j) = "AS" Then Range("R" & j).FormulaR1C1 = for2 Else If Range("E" & j) = "CF" Then Range("R" & j).FormulaR1C1 = for2 Else If Range("E" & j) = "CL" Then Range("R" & j).FormulaR1C1 = for2 Else If Range("E" & j) = "PI" Then Range("R" & j).FormulaR1C1 = for2 Else If Range("E" & j) = "GL" Then Range("R" & j).FormulaR1C1 = for2 End If End If End If End If End If If Range("L" & j) = "ENS" Then Range("M" & j).ClearContents Range("O" & j & ":S" & j).ClearContents Else If Range("L" & j) = "U" Then Range("M" & j).ClearContents Range("O" & j & ":S" & j).ClearContents Else If Range("L" & j) = "DIV" Then Range("M" & j).ClearContents Range("O" & j & ":S" & j).ClearContents Else If Range("L" & j) = "P" Then Range("M" & j).ClearContents Range("O" & j & ":S" & j).ClearContents End If End If End If End If If Cells(j, 19) < 0.2 Then If Cells(j, 19) <> "" Then Range("A" & j & ":T" & j).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 65535 .TintAndShade = 0 .PatternTintAndShade = 0 End With With Selection.Font .Color = -16776961 .TintAndShade = 0 End With Selection.Font.Bold = True End If End If If Range("K" & j) <> "" And Range("K" & j) <> 0 Then If (Range("Q" & j).Value / Range("K" & j).Value) < 500 And Range("E" & j).Value = "AS" Or Range("E" & j).Value = "PI" Then Range("A" & j & ":T" & j).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 65535 .TintAndShade = 0 .PatternTintAndShade = 0 End With With Selection.Font .Color = -16776961 .TintAndShade = 0 End With Selection.Font.Bold = True End If Range("M" & j).Value = Range("M" & j).Value / 1000 k = k + 1 j = j + 1 Loop
Cordialement,
Jordan
Partager