1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub test()
Dim Tabl() As String, Fich As String, C As Range, Ctr As Long
Dim Tabl1 As Variant, Tabl2 As Variant
Fich = Application.GetOpenFilename("Text Files (*.txt), *.txt")
Set sh = ActiveWorkbook
Ctr = -1
Workbooks.Open Fich
Set sh = ActiveWorkbook.Sheets(1)
With sh
ReDim Tabl(.Cells(.Rows.Count, 2).End(xlUp).Row, 1)
For Each C In .Range("B1", .Cells(.Rows.Count, 2).End(xlUp))
If InStr(1, C.Value, "TEXT IS") > 0 Then
Ctr = Ctr + 1
Tabl1 = Split(C.Value, " TEXT IS ")
Tabl(Ctr, 0) = Tabl1(0)
Tabl2 = Split(Tabl1(1), "'")
Tabl(Ctr, 1) = Tabl2(1)
End If
Next C
End With
End Sub |
Partager