Looping through an open file

Hap

Well-known Member
Joined
Jul 20, 2005
Messages
647
I have opened a text file and am attempting to loop through the lines of data. However, using the EOF function I can't seem to reset this setting without closing and reopening the file. So what's happening is when I try to start a new loop it recognizes that it's already at the end of the file and skips over the next loop. I'm assuming I'm missing something obvious. Any help would be greatly appreciated.
 
I have an comma delimited text file that has several thousand lines each of which have a little over a hundred columns. The first line in the text is notation line of which carries no data. The second line is a line of headings. The third starts the data. I am trying to read types of data which are listed as the first value, a specific data identifier in the second "column", and then columns of data related to each identifier. I currently have a set of checkboxes associated with the types on a userform that will load the list of identifiers into a combobox based on whether they are true or false.
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Whay not just open the csv file and operate on that?

If you DID do it that way, what kind of processing would you be doing?
 
Upvote 0
I'm trying to keep that side of it as hidden as possible due to the set of users. Earlier versions I just kept the data on a sheet in the workbook but the amount of data makes it an unwieldy file size for the computers being used. Also, I am going to be using the data to auto read/write another text file later on so I need to know how to work with it.
 
Upvote 0
I'm trying to keep that side of it as hidden as possible due to the set of users.
You could write the code so the user sees nothing.
Also, I am going to be using the data to auto read/write another text file later on so I need to know how to work with it.
That could be (don't know what kind of processing you're doing) as easy as opening the workbook, operating on it (hidden to the user), and writing it back out as another CSV file.

I'm not suggesting your approach is wrong, but it's easier to debug code when you can see the effect of operations on a worksheet (before you hide stuff).
 
Upvote 0
I do agree with that. And my second reason is definitely stronger than the first. Ultimately I am going to be writing a txt file that an industry program can read. After it gets processed by the industry program then I will import the data back into mine for post-processing. Right now, if I can figure out how to use the array properly I will be good to go.
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,823
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top