Sub ExtractTitles()
.. rr = 0 ' row counter
.. cc = 1 ' eg, Col A
.. MyFile = "c:\MyTextFile.txt"
.. Close #1
.. Open MyFile For Input As #1
.. For ii = 1 to 1000000 ' yes, 1,000,000!
.... If EOF(1) Then
...... Exit For
.... Endif
.... Line Input #1, NextLine
.... xtr = NextLine
.... If Left(xtr, 3) = "B/M" Then
....... rr = rr + 1
....... Cells(rr, cc) = Mid(xtr, 4)
.... End If
.... If rr = 65000 Then
....... rr = 1
....... cc = cc + 1
.... Endif
.... DoEvents
.. Next ii
End Sub
OK, what have we got here?
1. We initialize 2 vars, rr and cc, to serve as pointers.
Modify them as you see fit.
2. Then we open the text file (change name as required)
3. Then we enter a loop that reads the text file line by
line. The EOF statement gets you out at the end of file.
You might need more that 1,000,000 as your loop counter.
4. Then we check the left 3 characters of the extracted
text string. If it is "B/M", then we enter the branch.
5. Then, we place the rest of that line in the next row
of your active spreadsheet. rr is incremented by 1 to
assure next "hit" goes in the next row.
6. The trap at rr = 65,000 is optional. But, it would
enable you to get it all in 1 sheet if you don't mind
the rest spilling into the next column.
7. The DoEvents statement is also optional -- but while you
are debugging, its a good idea, especially in a massive
loop. This statement will give you the chance to end the
app without locking up your computer.
Natch, feel free to modify as required, but this should
give you the gist of what should work. Hope I understood
your needs correctly. Let me know if I went wrong anywhere.