Bonjour
pas terrible ton fichier Txt
peux être comme ca a voir
A+
Maurice
Private Sub ChoixFicTxt()
Dim ChoixChemin$
Dim dossier As FileDialog
ChoixChemin = ActiveWorkbook.Path & Application.PathSeparator
Set dossier = Application.FileDialog(msoFileDialogFilePicker)
With dossier
.AllowMultiSelect = False
.InitialFileName = ChoixChemin
.Title = "Choix d'un fichier TXT"
.Filters.Clear
.Filters.Add "Fichier Txt ", "*.txt*", 1
If .Show = -1 Then
Chemin = .SelectedItems(1)
LireTxt Chemin
End If
End With
Set dossier = Nothing
End Sub
Sub LireTxt(NomFichier)
Dim Ar() As String
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlManual
End With
Rows("1:" & Rows.Count).Clear
Sep = " "
Lig = 1
' -----------------------------------------
On Error Resume Next
Open NomFichier For Input As #1
Do While Not EOF(1)
Line Input #1, Chaine
Chaine = Application.Trim(Chaine)
Ar = Split(Chaine, Sep)
Col = 1
Test = Split(Chaine, Sep)(9)
If Test <> "0A20:00" Or Test <> "0A21:00" Then
For X = LBound(Ar) To UBound(Ar)
Tmp = Ar(X)
Cells(Lig, Col).Value = Tmp
Col = Col + 1
Next
Lig = Lig + 1
End If
Loop
Close #1
' -----------------------------------------
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.CutCopyMode = False
.Goto [A1], True
End With
End Sub