VBA Array

J

Jeff

I have code that takes five 100x100 matrix's and put them in the array

Array_Mortality(5,100,100)

The information comes from a spreadsheet = Mortality, the spreadsheet has
five tabs.

The code is in another spreadsheet that uses the array - with a bunch of
other code.

Question = usually I run a macro that uses Array_Mortality, then I might do
some other stuff and then run the macro again. It is a pain to keep opening
up the other file. Is there any way to permanently save the array, so I
don't have to keep on opening the other file, because this slows things down
a lot.

Thanks!
 
B

Bernie Deitrick

Jeff,

Declare the array as public at the top of your module:

Public Array_Mortality(1 to 5, 1 to 100, 1 to 100) As Double

Then fill it using a dedicated macro that does nothing else. Then, until you close the workbook,
the array will be available to all the other macros.

HTH,
Bernie
MS Excel MVP
 
Top