Bonjour,
Dim lColonne As Long
lColonne=0
Dim lLigne as String
Dim lDate as Date
Dim lTab1() as String
Dim lTab2() as String
Dim i As Long
Open "MonFichier" FOR Input As #1
Do Until Eof(1)
Line Input #1,lLigne
lDate=Mid$(lLigne,2,20)
lLigne=Mid$(lLigne,28)' On ne garde que la donnée utile
If Instr(lLigne," MESURE PLATEAU")=1 Then
'Nouvelle mesure
lColonne=lColonne+1
'Ajout du numéro de mesure
AddData lColonne,"Mesure",trim$(Split(lLigne,":")(1)
'Ajout de la date
AddData lColonne,"Date/Heure",lDate
Elseif Instr(lLigne,"=")<>0 Then
'Ligne de données
lTab1=Split(lLigne,";")
For i=lBound(lTab1) To uBound(lTab1)
lTab2=Split(Trim$(lTab1(i)),"=")
AddData lColonne,lTab2(0),lTab2(1)
Next
End if
Loop
Close #1
Public Sub AddData(ByVal pColonne as Long,ByVal pKey as String, ByVal pValue as String)
Dim lLigne as long
lLigne=1
Do while Cells(lLigne,1).Value<>"" And Cells(lLigne,1).Value<>pKey
lLigne=lLigne+1
Loop
'Si ligne non trouvée, on la créé
If Cells(lLigne,1).Value="" Then Cells(lLigne,1).Value=pKey
Cells(lLigne,1+pColonne).Value=pValue
End Sub
Code tapé hors de l'environnement, peut comporter des erreurs.
Normalement, ça devrait fonctionner, essayes de le tester en pas à pas pour voir ce qu'il fait.
Mon site