假设我确实有一个数组 A1(6)=(45,25,,36,88),A2(6)=(14,25,11),A3(6)=(11,21,20,25,48 )。现在我们可以借助单个语句(例如将单个数组赋值给一行)来放置这些数组值,就像这里的所有行到 Excel 的一个范围一样,在这里说“C1:R3”范围。
Dim R
R = Split(Join(A1, ",") & "," & Join(A2, ",") & "," & Join(A3, ","), ",")
Range("C5:T5").Value = R
现在我们可以将字典项(它是一个数组)组合成一个一维数组并分配回一个范围吗?
For Each ChilID In ChildIDs
Redim ChildDetailArray(ArrIndex)
ChildMatchNum=objExcel1.Application.WorksheetFunction.Match(ChilID, ob3.Columns(1), 0)
ChildDetailArray=ob1.Range(ob1.Cells(ChildMatchNum,1),ob1.Cells(ChildMatchNum,ArrIndex+1)).Value
ChildDic.Add ChilID,ChildDetailArray '(ChildDetailArray is an array)
Next
编辑1
suppose a process#20 has 2 child processes say #12,#13. now i used a dictionary object Dic
Dic(12)=Arr(10,11,,,18) 'child details
Dic(13)=Arr(5,8,9,,,) ' child details
***Output:*** `1D array say ArrMerger()=(10,11,,,18,5,8,9,,,)`
上面For Loop
的做法是一样的。现在Loop
完成后,我希望那些作为 Dic(12) 和 Dic(13) 项目的子详细信息需要收集在一维数组中
更新
strJoin = ","
For ChildKey In ChildDic.Keys
strJoin=Join(ChildDic(ChildKey),",") & strJoin
Next
谢谢