return an entire row of a multidimensional array in VBA to a one dimensional array
There is a simple way to get a column or a row of a two-dimensional array. Assign a zero to column to get the row, or assign a zero to row to get the column, thus:
Application.WorksheetFunction.Index(array, 0, columnyouwant) /* or */
Application.WorksheetFunction.Index(array, rowyouwant, 0)
See here: How do I slice an array in Excel VBA?
No there is no VBA-function to get a row or column. You can only write it yourself, or take a look here:
http://www.cpearson.com/excel/vbaarrays.htm
This is what I do to easily print out one dimension of a multidimensional array.
Basically, I define a new, 1D array and stuff it with the values from the bigger array.
Example (3D to 1D to Printout):
Sub PrintItOut()
ReDim big_array(10,5,n) as Variant, small_array(n) as Variant
'use multidimensional array
'place multi-dimensional values into the 1D array
For i = 0 to n
small_array(i) = big_array(0, 0, i)
Next
Range(Cells(1, 1), Cells(1, n + 1)) = small_array
End Sub
That's how I do it. I hope that makes sense to whoever may be reading it. I think it's a very simple way to do it.