开发者

How do you strip useful values out of a multi-dimensional VBA array?

Function returns a 4-dimensional array in the form (j,0)(i,0). Want to convert this into a 2-dimensional array in the form (j,i). How do I move the values i to the slot bound next to j and t开发者_开发知识库hen re-dimension the array to remove the "spare" two dimensions?


Splitting your question into two parts:

1. How do I move the values i to the slot bound next to j

Create a new two-dimensional array. Loop through both arrays and assign values from the old four-dimensional array to the new two-dimensional array as appropriate. Then Erase the old four-dimensional array to free up memory.

2. and then re-dimension the array to remove the "spare" two dimensions?

This is not possible -- or at least not without erasing the array contents. You could remove the flat dimensions using ReDim, but erases all the data contained in the array, thus defeating your purpose.

That's why I made you make a new array in part 1 above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜