VBA Array

July 22, 2010 at 01:23:08
Specs: Windows Vista
Visual Basic for Applications

How to save a two dimensional array 5 million rows x 5 colums(created by generating, the process of generating consumes a lot of time ) in order to refer to it every time you want ?

See More: VBA Array

July 22, 2010 at 15:19:14
Hard to tell exactly what you're looking for. There are many ways to make data persistent.

Report •

July 22, 2010 at 23:44:38
I've generated a two-dimensional array wich consists of aprox. 10 millions rows. So, it's impossible to store such huge an array in Excel. On the other hand there wouldn't be nessecity in saving the array if it wouldn't take a lot of time to generate it ( 2 hours).
Now I'm forced to generate it every time I debug my macro. In order to do the usual things with this array: to find max and mins in this or that row etc.
I'm looking for saving the array in such a way that every time I open VBA there will be the posibility to refer to the array, to it's rows and columns, to it's numbers etc.

If there are a lot of ways to do it, just a one would be enough.

Report •

July 23, 2010 at 05:26:28
I'm just going to assume you've already tried the standard approaches. Namely just making the array global, or making the array static.

You might be in luck; Excel is kind of like a huge 2D array. You could try to create a sheet, and store the relevant data there.

If not, you might need to create a file to store the data, then load that file into the array.

Since you're talking about debugging, I'll assume this isn't an issue in production. If that's the case, you might try using a smaller sample. A sample that only takes a minute or less to process.

If it is an issue in production, you might need to look into another language; say C or C++.

Report •

Related Solutions

July 23, 2010 at 05:54:02
"If not, you might need to create a file to store the data, then load that file into the array."

OK, I've been already given an advice to create a text file (.txt ) and keep the array there.

The only thing that lacks is a code. Could you help me in writing it or give a link to a code telling how to save an array into a text file.
Thanks beforehand.

Report •

Ask Question