General question on multidimensional variables

  • Thread starter Thread starter marston.gould
  • Start date Start date
M

marston.gould

I have the following situation:
300+ forecasts
Each forecast is built from one of ~4100 candidate structured formula
Each candidate structured formula has 34 items of data

Any variable that I set up that is 300 x 4100 x 34 runs out of memory.

I've tried creating 34 variables each that are 300 x 4100 but that seem very inefficient.
 
Any variable that I set up that is 300 x 4100 x 34
runs out of memory.

I had no problem executing the following macro:


Sub doit()
Dim v(1 To 300, 1 To 4100, 1 To 34) As Long
Dim n As Long, st As Double
st = Timer
For i = 1 To 300: For j = 1 To 4100: For k = 1 To 34
n = n + 1
v(i, j, k) = i * 1000000 + j * 100 + k
Next k, j, i
MsgBox n & " " & Format(Timer - st, "0.000 sec")
End Sub


The array v consumes 167,280,000 bytes. Task Manager showed that the peak
usage was about 186,968,064 bytes. Note the peak usage for Excel (new
workbook) and VBA (trivial macro) is about 19,402,752. So the numbers are
about right.

The run time was about 10.5 seconds.

Of course, that is for my version of Excel (2003) on my computer. YMMV.
 
Back
Top