Sub TestLecture()
Dim Z As String, T(), S() As String, L&, C&
ReDim T(1 To 100000, 1 To 32)
Open "C:\Documents and Settings\luck\Mes documents\APC__QOH_Report_200515.txt" For Input As #1
Line Input #1, Z
S = Split(Z, "|")
ReDim T(1 To 100000, 1 To UBound(S) + 1)
L = L + 1
For C = 0 To UBound(S): T(L, C + 1) = S(C): Next C
While Not EOF(1)
Line Input #1, Z
S = Split(Z, "|")
If UBound(S) >= 5 Then
If S(5) = "MBDW5PIC" Then
L = L + 1
For C = 0 To UBound(S): T(L, C + 1) = S(C)
Next C: End If: End If: Wend
Close #1
Feuil2.Cells.ClearContents
Feuil2.[A1].Resize(L, UBound(T, 2)).Value = T
End Sub