Using Redim on 2 dimensional array
I don't think you're reading that response quite right. He is saying that it
is possible to change the UPPER or LOWER bounds of the SECOND dimension in a
specific case. You still can't change the bounds of the first dimension of
the array.
As he points out, there are functions out there that will redimension
multi-dimensional arrays while preserving their contents. It's just that
those functions are not built in to Excel.
HTH,
Eric
Dim Arr()
Redim Arr(1 to 10, 1 to 2)
ReDim Preserve Arr(1 to 10, 1 to 4)] <-- Only upper bound of 2nd dim is changed!
Dim Arr
Redim Arr(1 to 10, 1 to 2)
ReDim Preserve Arr(1 to 10, 0 to 3)] <-- Upper and lower bounds are changed!
If the functions in the freely downloadable file at
http:/home.pacbell.net/beban are available to your workbook, then you
can use the ResizeArray function to preserve the values of the array
that is passed to it and change the lower and/or upper bounds of any or
all of the dimensions of a one-, two- three- or four-dimensional
array, or increase (up to 4) or decrease the number of the array's
dimensions (whether or not the array is contained within a Variant type
variable).
|