Is there a way to create a 2-dimensional array in VBA using Array function>

I want to quickly create a 6X4 array of small integers. For a small 1-dimensional array, I like to use something like Dim MyArr() MyArr = Array(1,2,3,4,5,6)

Is there a similar way to create a 2-D array? I tried separating the rows with ; but MyArr = Array (1, 2, 3; 4, 5, 6) is invalid.

I guess I'm being too lazy to set up the loops, but a one-line method would be compact and useful.



Read more here: https://stackoverflow.com/questions/67014070/is-there-a-way-to-create-a-2-dimensional-array-in-vba-using-array-function

Content Attribution

This content was originally published by Freond at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: