Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thx for the effort.
-----Original Message----- jacob wrote: Hi, Have a 2D array where each element contain a new 2D array. Is it possible to perform a 'Redim Preserve' on an array contained in the "mother" array? If so, what is the proper syntax? Any help appreciated. The following seems to me kludgy, but the straightforward ReDim Preserve motherArray(1,1)(3,5) wouldn't compile-- syntax error Sub abc() Dim motherArray() As Variant Dim containedArray() As Variant Dim arrtemp() As Variant Dim i As Long, j As Long ReDim motherArray(1 To 2, 1 To 2) containedArray = Range("A1:D3") For i = 1 To 2: For j = 1 To 2 motherArray(i, j) = containedArray Next: Next arrtemp = motherArray(1, 1) 'Debug.Print UBound(motherArray(1, 1), 2) 'Check original UBound ReDim Preserve arrtemp(3, 5) motherArray(1, 1) = arrtemp 'Debug.Print UBound(motherArray(1, 1), 2) 'Checked changed UBound 'Debug.Print motherArray(1, 1)(3, 4) 'Check preservation Erase arrtemp End Sub Alan Beban . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Two arrays same? | Excel Discussion (Misc queries) | |||
Arrays | Excel Discussion (Misc queries) | |||
Arrays | Excel Programming | |||
Arrays | Excel Programming | |||
help with arrays | Excel Programming |