ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help to read data from a text file (https://www.excelbanter.com/excel-programming/414514-need-help-read-data-text-file.html)

Harish

Need help to read data from a text file
 
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

NoodNutt

Need help to read data from a text file
 
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.



Harish

Need help to read data from a text file
 
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

Harish

Need help to read data from a text file
 
Does anyone have a solution to this problem? Thanks

On Jul 23, 9:50 pm, Harish wrote:
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




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com