I have an array with 3 dimensions. I would like to access this array from several modules in Excel VBA. For that reason I use Public to declare it. Currently I use this code:
Public MyData(1 To 400, 1 To 10, 1 To 3000) As Double
I would like to initialize the first and third variable once at startup of my code at a certain value depending on the sizes of my data.
Since ReDim can only be used for the last variable in an array I am trying to do something like this although this is not possible:
If x < 400 and z < 3000 Then
Public MyData(1 To 400, 1 To 10, 1 To 3000) As Double
End If
If x < 200 and z < 1000 Then
Public MyData(1 To 200, 1 To 10, 1 To 1000) As Double
End If
Is there a way to initialize an array based on a condition (the value of x and z below a certain level)?
Thank you!