LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Text File to Excel Cells

I wish to import financial data from numerous text files into Excel
worksheets. The text files are fixed width, designed for printing one page
each. But the column formatting varies from file to file, and sometimes
varies within file (the top half will have 5 columns, the bottom half two). I
*think* the following is the general approach I need to use (and my questions
are contained in brackets):
1. Open text file and read start a loop to read in one line at a time.[I
think I know how to code this; pretty sure I want sequential input.]
2. Search for key words (e.g. Assets, Securities) that signify the desired
line [how do I say 'if line contains "Assets" then...'? The keyword may not
always be at the start of the line.]
3. When desired line is found, then use MID function to extract the desired
substring [I should be able to use specific position counts as long as the
file format doesn't change.] Convert that sub-string to a number [syntax??
for this step] [Will leading blanks in the sub-string cause a conversion
error? How would a string of blanks be converted, if at all?]
4. Place number in array and end loop. [How, if I need to, do I begin again
at line one of a particular file for a new keyword search?]
5. When all data is collected, write array to an excel column.

Final question: A total of about 240 files are involved. Is there a more
efficient method out there, or will this be fast enough (I'm prepared to wait
5 minutes, not 30, for this to chug along).

As you can tell from the questions, I'm a newbie. Any and all help
appreciated.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
assign values to specific cells in an excel sheet through text file s_pushparaj Excel Discussion (Misc queries) 2 May 11th 08 10:09 PM
Inserting text from external file into cells. warirv63 Excel Discussion (Misc queries) 0 April 16th 08 07:27 AM
Excel VBA - open text file, replace text, save file? Cybert Excel Programming 2 October 2nd 04 01:05 AM
excel vba : how to split characters in text file into cells? paku[_2_] Excel Programming 6 April 13th 04 02:53 PM
Cells to Columns in Text File MacroAlan Excel Programming 4 September 12th 03 01:39 PM


All times are GMT +1. The time now is 02:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"