Bonjour tout le monde,

Je vous souhaite dorénavant une trés bonne année 2008.

J'ai un problème sur mon programme vba j'essai d'ajouter une condition avec if...then goto...else mais quand je compile il me dit "else sans if" pourriez vous m'aider SVP?

voici le prog :

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
Sub Macro2()

Dim Aryan As String
Dim i As Long
Dim j As Long

j = 0

 For i = 71001 To 71005

    Aryan = "Appft\MER\1\logAppliVOCAL\" & _
        Worksheets("Feuil3").Range("A3001") & "\APPLIVOCAL0" & i & ".LOG"
    
    If Dir(Aryan) = "" Then GoTo boz
    Else
    
    
    With ActiveSheet.QueryTables.Add(Connection:= _
    "TEXT;C:\" & Aryan, _
    Destination:=Range("O1"))

        .Name = "APPLIVOCAL071211_1"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 850
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = True
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = True
        .TextFileOtherDelimiter = "="
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
        1, 1, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With

Dim N, y As Integer

N = 1

y = 0

Do

            If Worksheets("Feuil3").Cells(N, "Y") = "FLAGS" Then

                        y = y + 1

            End If

            N = N + 1

Loop Until N = 2999

            j = j + 1
            
Worksheets("Feuil3").Cells(j, 1) = y
            
Range("B1:EZ2999").Select
    Selection.ClearContents

boz:
    i = i + 1
Next i

j = 1
For j = 1 To 2998
If Worksheets("Feuil3").Cells(j, 1) <> "" Then
Worksheets("Feuil3").Cells(j + 1, 1) = Worksheets("Feuil3").Cells(j, 1) + Worksheets("Feuil3").Cells(j + 1, 1)

End If

Next j

Worksheets("Feuil3").Cells(1, 2) = Worksheets("Feuil3").Cells(j, 1)

Range("A1:A2999").Select
    Selection.ClearContents
Range("B1").Select

   End Sub