-
I have an array:
Dim MyArray (1 to 20, 9)
How can a Rediminsion the first part of the array?
Later in the code, I need to increase it's size to an unknown amount: (1 to X, 9)
The '9' never needs to change........ I tried a few different ways of using the ReDim statement, but none have worked.
BTW - I assume you don't loose data already stored when you do this?
Thanks for any help.
-
Actually you WILL lose data preforming a re-dimension this way. The proper way to re-dim an array follows :
Dim x() as string
Dim counter as long
for counter = 0 to 100
redim preserve x(counter)
x(Counter) = cstr(Counter) '(or whatever value you want)
next counter
Hope this helps.....
-
Switch dimensions.
You can ReDim the last dimension without losing data.
Can you rewrite the code to allow the dimension you want to change to be the last one?