Though I'm certain someone here could work out a VBA program to open and
then read the text file, I think your situation could be more easily
rectified via Access. You can link or import the text file into Access,
and then build a query using the criteria you just stated. It's fast and
simple. Then you can export the query to Excel.