Avatar of A G
A G
Flag for United States of America

asked on 

Out of Memory error on VBA because of an array

I have an array c() which is defined as a double. and it has 2 dimensions.

I am running simulations on vba and this variable is redim according to the user's desired number of simulations and number of values they want to use. However when the number of numbers they want to use and the number of simulations are a lot, excel vba gives an "Out of Memory" error highlighting the redim of the array  C.

For example lets say Redim C(a1,a2)

a1 is the number of values that are going to be used and a2 is the number of simulations.
If I try a2=100 and a1=2620905, it doesnt work and gives me the "out of memory" error.

I need to go down to a2=10 in order to make it work. but i want to set a2 as 1000 at least.

How can I overcome this issue?

Should I define array C as something else so it can hold more values.
Visual Basic ClassicMicrosoft Excel

Avatar of undefined
Last Comment
aikimark

8/22/2022 - Mon