Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove lines from text file prior to importing in Excel
I've scoured the usual sources, but haven't found any existing code
that will accomplish what I need, so here's my situation. I've got a large text file from my company's mainframe. It's around 120,000 lines, with each record from a particular database taking up several lines (generally 8 to 16). Of those lines, only 4 of them are needed for the output file I need to produce. Since there is an import limit on Excel 2003, I'd like to remove the extraneous lines prior to the actual opening of the file in Excel. It should be pretty easy to isolate which lines to delete: Example data: RECORD1 11 DATA-01 DATA-25 DATA-49 RECORD1 14 DATA-02 DATA-26 DATA-50 RECORD1 17 DATA-03 DATA-27 DATA-51 RECORD1 20 DATA-04 DATA-28 DATA-52 RECORD1 31 DATA-05 DATA-29 DATA-53 RECORD1 34 DATA-06 DATA-30 DATA-54 RECORD1 37 DATA-07 DATA-31 DATA-55 RECORD1 40 DATA-08 DATA-32 DATA-56 RECORD2 11 DATA-09 DATA-33 DATA-57 RECORD2 14 DATA-10 DATA-34 DATA-58 RECORD2 17 DATA-11 DATA-35 DATA-59 RECORD2 20 DATA-12 DATA-36 DATA-60 RECORD2 31 DATA-13 DATA-37 DATA-61 RECORD2 34 DATA-14 DATA-38 DATA-62 RECORD2 37 DATA-15 DATA-39 DATA-63 RECORD2 40 DATA-16 DATA-40 DATA-64 RECORD3 11 DATA-17 DATA-41 DATA-65 RECORD3 14 DATA-18 DATA-42 DATA-66 RECORD3 17 DATA-19 DATA-43 DATA-67 RECORD3 20 DATA-20 DATA-44 DATA-68 RECORD3 31 DATA-21 DATA-45 DATA-69 RECORD3 34 DATA-22 DATA-46 DATA-70 RECORD3 37 DATA-23 DATA-47 DATA-71 RECORD3 40 DATA-24 DATA-48 DATA-72 Basically, the 9th and 10th characters of a row would determine whether or not I keep the line or delete them. I know how to do this in VBA (Basically a match using If Mid(Cells(currow, 1), 9, 2) < "[Value to Match]" And etc...), but I can't figure out how to manipulate the text prior to importing to avoid that 65,000 row limit. Any help would be appreciated. Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Modify The Code For Importing Text File into an Excel File | Excel Programming | |||
How do I remove lines through text in excel | Excel Discussion (Misc queries) | |||
Importing Text Files of 100,000+ lines, many blanks | Excel Programming | |||
Importing data from a Text File, Not enough lines? | Excel Programming | |||
Importing Multiple lines of text in a single Excel Cel | Excel Programming |