Bonjour,
J'ai deja un formulaire html qui doit etre rempli apres avoir cliquer sur valider j'aurai un fichier txt alimenté derriere avec toutes les informations requises , et en cliquan sur la macro je recupere toutes les données sur excel : mon probleme c'est que j'ai besoin de garder sur excel plusieurs lignes car il me garde que la derniere ligne et je ne sais pas comment ajouter ce controle
je vx mets le code et je vous remercies pour vos reponses

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
Dim ExDate0 As String
Dim ExDate10 As String
Dim ExDate20 As String
 
Dim ExDate1 As String
Dim ExDate11 As String
Dim ExDate21 As String
 
Dim ExDate2 As String
Dim ExDate12 As String
Dim ExDate22 As String
 
Dim E1 As String
Dim E2 As String
Dim E3 As String
Dim E4 As String
Dim E5 As String
Dim E6 As String
Dim E7 As String
Dim E8 As String
Dim E10 As String
Dim E11 As String
Dim E12 As String
Dim E13 As String
Dim E14 As String
Dim E15 As String
Dim E16 As String
Dim E17 As String
Dim E18 As String
Dim E19 As String
Dim E20 As String
Dim E21 As String
Dim E22 As String
Dim E23 As String
Dim E24 As String
Dim E25 As String
Dim E26 As String
Dim E27 As String
Dim E28 As String
Dim E29 As String
 
Dim E30 As String
Dim E31 As String
Dim E32 As String
Dim E33 As String
Dim E34 As String
Dim E35 As String
Dim E36 As String
Dim E37 As String
Dim E38 As String
Dim E39 As String
Dim E40 As String
Dim E41 As String
Dim E42 As String
Dim E43 As String
 
 
Open "D:\Documents and Settings\fichie.txt" For Input As 5
 
 '
 
 nbtour = 0
 While EOF(5) = False
 Line Input #5, lignesuivante
 If (InStr(lignesuivante, "pppp") = 1) Then nbtour = nbtour + 1
 Wend
 Close #5
    'MsgBox (nbtour)
 
 
    Sheets("Proposition").Select
    Rows("2:31").Select
    Selection.Delete Shift:=xlUp
    Range("A6").Select
    Workbooks.OpenText Filename:= _
        "D:\Documents and Settings\oasis\fichie.txt",
        Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
        Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
        TrailingMinusNumbers:=True
 
 
 
 
 
 
    ''éliminer le décalage de cellules''''
    Windows("fichie.txt").Activate
    Range("A1").Select
    Selection.Delete Shift:=xlUp
    ''''''''''''''''''''''''''''''''''''''
 
    pos1 = 17
    pos2 = 18
    pos3 = 19
 
    pos = 0
 
    While (nbtour >= 0)
 
    'récupération des date dans des variables
        Dim Exemple As Date
        Dim exemple1 As Date
        Dim Exemple2 As Date
 
         If Range("A" & pos1).Value <> "" Then
        Exemple = Format(Range("A" & pos1), "mm/dd/yyyy")
        End If
        If Range("A" & pos2).Value <> "" Then
        exemple1 = Format(Range("A" & pos2), "mm/dd/yyyy")
        End If
        If Range("A" & pos3).Value <> "" Then
        Exemple2 = Format(Range("A" & pos3), "mm/dd/yyyy")
 
        End If
 
 
 
        'ExDate0 = Left(Exemple, 2)
        'ExDate10 = Mid(Exemple, 4, 2)
        'ExDate20 = Right(Exemple, 4)
 
 
 
        'ExDate1 = Left(exemple1, 2)
        'ExDate11 = Mid(exemple1, 4, 2)
        'ExDate21 = Right(exemple1, 4)
 
 
        'ExDate2 = Left(Exemple2, 2)
       ' ExDate12 = Mid(Exemple2, 4, 2)
 
 
 
    decal = 2 + pos
 
    'Windows("fichie.txt").Activate
   E1 = Range("A1").Value
    E2 = Range("A2").Value
    E3 = Range("A3").Value
    E4 = Range("A4").Value
    E5 = Range("A6").Value
    E6 = Range("A5").Value
    E7 = Range("A7").Value
    E8 = Range("A8").Value
    E9 = Range("A9").Value
    E10 = Range("A10").Value
    E11 = Range("A11").Value
    E12 = Range("A12").Value
    E13 = Range("A13").Value
    E14 = Range("A14").Value
    E15 = Range("A15").Value
 
 
    E16 = Range("A16").Value
    E17 = Range("A20").Value
    E18 = Range("A21").Value
    E19 = Range("A22").Value
    E20 = Range("A23").Value
    E21 = Range("A24").Value
    E22 = Range("A25").Value
    E23 = Range("A26").Value
    E24 = Range("A27").Value
    E25 = Range("A28").Value
    E26 = Range("A29").Value
    E27 = Range("A30").Value
    E28 = Range("A31").Value
    E29 = Range("A33").Value
    E30 = Range("A32").Value
    E31 = Range("A33").Value
    E32 = Range("A34").Value
    E33 = Range("A35").Value
    E34 = Range("A36").Value
    E35 = Range("A37").Value
    E36 = Range("A38").Value
    E37 = Range("A39").Value
    E38 = Range("A40").Value
    E39 = Range("A41").Value
    E40 = Range("A42").Value
    E41 = Range("A43").Value
    E42 = Range("A44").Value
    E43 = Range("A45").Value
 
    Application.WindowState = xlMinimized
    Windows("Oasis v1 1.xls").Activate
    Range("D" & decal).Value = E1
    Range("E" & decal).Value = E2
    Range("F" & decal).Value = E3
    Range("G" & decal).Value = E4
    Range("I" & decal).Value = E5
    Range("H" & decal).Value = E6
    Range("J" & decal).Value = E7
    Range("K" & decal).Value = E8
    Range("L" & decal).Value = E9
    Range("M" & decal).Value = E10
    Range("N" & decal).Value = E11
    Range("O" & decal).Value = E12
    Range("P" & decal).Value = E13
    Range("Q" & decal).Value = E14
    Range("Q" & decal).Value = E15
    Range("R" & decal).Value = E16
    Range("AA" & decal).Value = E17
    Range("AB" & decal).Value = E18
    Range("AC" & decal).Value = E19
    Range("AD" & decal).Value = E20
    Range("AE" & decal).Value = E21
    Range("AF" & decal).Value = E22
    Range("AG" & decal).Value = E23
    Range("AH" & decal).Value = E24
    Range("AI" & decal).Value = E25
    Range("AJ" & decal).Value = E26
    Range("AK" & decal).Value = E27
    Range("AL" & decal).Value = E28
    Range("AM" & decal).Value = E29
 
 
 
     If (nbtour > 0) Then
 
        Range("S" & decal).Value = Day(Exemple)
        Range("T" & decal).Value = Month(Exemple)
        Range("U" & decal).Value = Year(Exemple)
 
        Range("V" & decal).Value = Day(exemple1)
        Range("W" & decal).Value = Month(exemple1)
        Range("X" & decal).Value = Year(exemple1)
 
        Range("Y" & decal).Value = Day(Exemple2)
        Range("Z" & decal).Value = Month(Exemple2)
 
 
        Range("AM" & decal).Value = E30
        Range("AN" & decal).Value = E31
        Range("AO" & decal).Value = E32
        Range("AP" & decal).Value = E33
        Range("AQ" & decal).Value = E34
        Range("AR" & decal).Value = E35
        Range("AS" & decal).Value = E36
        Range("AT" & decal).Value = E37
        Range("AU" & decal).Value = E38
        Range("AV" & decal).Value = E39
        Range("AW" & decal).Value = E40
        Range("AX" & decal).Value = E41
        Range("CB" & decal).Value = E42
        Range("CC" & decal).Value = E43
    End If
    'Windows("fichie.txt").Activate
 
    'Range("A34").Select
    'Application.CutCopyMode = False
    'Selection.Copy
    'Windows("Oasis v1 1.xls").Activate
    'Windows("fichie.txt").Activate
    'Windows("Oasis v1 1.xls").Activate
 
    Windows("fichie.txt").Activate
    Range("A1:B46").Select
    Selection.Delete Shift:=xlUp
 
    nbtour = nbtour - 1
    pos = pos + 1
     'if nof((D:\Documents and Settings\fichie.txt))
    Wend
 
    Application.DisplayAlerts = False
 
    ActiveWorkbook.SaveAs Filename:= _
       "D:\Documents and Settings\fichie.txt", FileFormat:=xlText, _
       CreateBackup:=True
        Application.DisplayAlerts = False
     ActiveWorkbook.Saved = True
     ActiveWindow.Close
 
    Windows("Oasis v1 1.xls").Activate
    Sheets("Proposition").Select
    Range("G2").Select
 
    Sheets("Application").Select
    Application.WindowState = xlMaximized
 
 
 
End Sub