View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
crazybass2 crazybass2 is offline
external usenet poster
 
Posts: 167
Default File truncation with VBA

I have several text files that are very large (500MB+). There is a keyword
in each file ("Array") at which point I don't need the data below and
including the line in appears. Problem is, using a text editor for such a
large file makes it nearly impossible to Find, Select-to-End, Delete.

I currently have an excel file that will input each line into a cell and
until it reaches the keyword. Once the keyword is found, the file is closed
and a new file is opened and all the cells are written to the file. With
files as large as I have go thru this process it takes more than two hours to
finish. I'm sure that the majority of the time is spent writing the data to
the cells and writing it back to a new file.

Is there a way (in Excel) to find a keyword in a text file and delete
everything from that line on?