Need help to read data from a text file

H

Harish

Hi,

I have a data which is poorly organized on a text file (it was taken
out from a very old computer when we did lab experiments). However, I
can you this. There is a 2 conseqent rows of data (2nd row of data is
not important) in which I only want the code to read the 5th number of
1st row and insert that value in excel. The value consists of about 2
digits and 12 decimal places. I would appreciate if anyone can make a
code to read from the text file and copy the 5th number from this file
and insert it in excel vertically. I don't have a very good VB
experience but i have come across some good VB programmers and I would
like to give them the opportunity to solve this problem. I can send
this text file to you if you want to try. Please give me your email
address and I'll send it to you.

Mahadevan Swamy
 
N

NoodNutt

G'day Mahadevan

Take a look at the following link

http://www.rondebruin.nl/txtcsv.htm

The code will do pretty much what you need.

Where the code states this

..TextFileStartRow = 1

change it to

..TextFileStartRow = 5

Assuming the TXT file has no header row, if so, then your row start would be
6.

HTH
Mark.
 
H

Harish

Hi,

Thanks for your help. I tried the macro and your suggestion and i find
that there is a poor organization of data. The numbers are all over
the place in excel spreadsheet and this doesn't give me what I need. I
tried the second suggestion on the website which is txt files with a
Fixed Width but the problem is some of the numbers on some rows has a
fixed width while other rows doesn't have fixed width. The criteria i
want to put in the code is in every 1st row of the data, the 5th
number has to be read and put in a spreadsheet. I can send you the
file that has the data so you could analyze and tell me what
components to correct in the code. Let me know if you want to do that.
Thanks

Mahadevan Swamy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top