I am loading data from a CSV into a dynamic array that I size before reading the data into it. First thing I do is open the file and count the lines.

Open FileName For Input As #1
Do Until EOF(1)
Line Input #1, SomeVariable
Linecount = linecount + 1
Loop
Close #1

Then I ReDIM my array to the line count

Redim MyArray(linecount,5)

After that I reopen the file and load the array from the file. Although this works for now for a couple of hundred records I have some concerns when the data grows. This is for data import and is only temporary for loading into DB. So is there a way to count the lines without reading all of them? Then I can change the code to process 100 lines at a time until done. That way avoiding some huge array that chokes out of memory or something.

Thanks