Doing some calc AOO basic programming. I wish to create an array of arrays (a multi-dimesional array will not suffice, and
speed is also an issue so copying array cells one by one is not a good solution.)
Code: Select all
Dim oNewArrays() ' This should be an array containing other 2D-arrays
Dim oNewArray() ' The singular of the above, oNewArray() might equal oNewArrays(7), for example
' Calculate iFiles to Track which may be near 12 ...
' Also calculate LGroupNewEndRow and iTotalCols
ReDim oNewArrays(0 to iFilesToTrack)
' Now we wish to make each oNewArrays(index) contains 2D arrays
for For iGroup = 1 to iFilesToTrack
' ReDim oNewArrays(iGroup) (0 to5, 0 to 5) ' This and similar statements with oNewArray(iGroup) all fail
' The following runs, but only the last value is correct .. the others are overwritten
ReDim oNewArray(0 to LGroupNewEndRow, 0 to iTotalCols)
oNewArrays(iGroup) = oNewArray
oNewArray(1, 1) = "This only shows up for the last iGroup of " & iGroup ' Others are overwritten by ReDim oNewArray ....
Next iGroup
I've also tried the following
Code: Select all
' Same as above up to the loop ......
for For iGroup = 1 to iFilesToTrack
oNewArray = oNewArrays(iGroup)
ReDim oNewArray(0 to LGroupNewEndRow, 0 to iTotalCols)
' This leads to a "Cannot coerce argument type during co-reflection call" error below
' ... various processing setting oNewArray values, and setting oRange ....
oRange.setDataArray(oNewArray)
Next iGroup
If iFilesToTrack is small I can declare separate variables oNewArray1, oNewArray2, .... oNewArray12, reDim each and set
oNewArrays(1) to oNewArray1, oNewArrays(2) to oNewArray2, etc., but this is cumbersome and limited.