1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Sub ImportTxtetSuprLigne()
Dim FichierTxt
Dim Lig As Long
FichierTxt = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FichierTxt <> False Then
With Worksheets("Feuil1")
.UsedRange.ClearContents
With .QueryTables.Add(Connection:="TEXT;" & FichierTxt & "", Destination:=.Range("A2"))
.TextFileSemicolonDelimiter = True
.Refresh BackgroundQuery:=False
.Delete
End With
End With
End If
Lig = Sheets("Feuil1").Range("A" & Rows.Count).End(xlUp).Row
For I = Lig - 10 To 2 Step -1
Sheets("Feuil1").Rows(I).Delete
Next I
End Sub |
Partager