View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Copy values (loop) from TXT file to excel

I usually find problems like this arre better solved by modifying the text
file. I usually write a filter which reads one text file and write the
modified text to a second file.

In this case I would create a CSV file and then read the CSV file into excel
after the changes are made.

I would add semicolons to force excel to read data into a new column, and
add carriagge returns to have excel put the data in a new row.


" wrote:

I have a problem wich i cant seem to resolve.
Posted it before, but this is hopefully a better explanation;

Have a txt file with alot of data placed in one row (50.000 rows).
Across this row of data there is a constant value coming back called
SHEET

If imported in excel;


Example: SHEET 7K295 or SHEET 6H320 etc.

So find the string SHEET and when found copy the name
SHEET +7K295
I want to do this in a loop (the value SHEET could exist more than
100
times in that column).

And then also copy the 4th row below the string "SHEET", and the
9th,
the 14th and 19th and put those values like this in excel: (4,9,14,19
= always constant so this is the same for all data)


ColumA
SHEET 7K295
SHEET 6H320
etc

Column B
data 4th row below SHEET 7K295
data 4th row below SHEET 6H320
etc


Column C
data 9th row below SHEET 7K295
data 9th row below SHEET 6H320
etc


Column D
data 14th row below SHEET 7K295
data 14th row below SHEET 6H320
etc


Column E
data 19th row below SHEET 7K295
data 19th row below SHEET 6H320
etc

Hopefully someone can help!