View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sheela Sheela is offline
external usenet poster
 
Posts: 27
Default import from text file with VBA code

How do I automate the process of importing data from a text file into excel?

The text file contains multiple types of results including other summary
information. I would like to import the each test results into each excel
tab/sheet.
I would like to implement a VBA code with the following criteria.

1) to search for a row with a single word: €œResult€ ( the search word
should be case sensitive)and start import the text from next row
2) Import each row of the text file into each row of the excel file.
3) The text to import is delimited by space character.
4) And stop importing once it encounters a row of €œ-----€œ .
5) Then continue the search for next row with the text €œResult€ and import
the text starting from next row into another tab of the same sheet until it
hits a series of €œ----€œ
6) Continue this process until end of the text file

Is it possible to do this at all in excel? If not could you suggest another
program to do this?

My text file to import into excel looks something like this.

Date test was run: xxxxxxx
Some ID:xxxxx
Someother ID : xxxxxx
Someother text:xxxxxxxxx
Summary :
XXXXX
XXXXXXXXXXXX
XXXXXXXXXX
Result
1 White 2.141 Star 1.000
1 White 0.703 Star 1.000
2 Red 0.594 Star 1.000
2 White 0.734 Star 1.000
2 White 0.657 Star 1.000
3 Black 0.610 Star 1.000
------------------------------
Date test was run: xxxxxxx
Some ID:xxxxx
Someother ID : xxxxxx
Someother text:xxxxxxxxx
Summary :
XXXXX
XXXXXXXXXXXX
XXXXXXXXXX
Result
1 Triangle 2.141 AAA 1.000
2 Triangle 0.703 AAA 1.000
3 Round 0.594 ABC 1.000
3 Rectangle 0.734 DSA 1.000
3 Square 0.657 WQA 1.000
4 Round 0.610 RVG 1.000
--------------------------------------
And so on..


--
Thank you in advance for your help,
Sheela.