Does anyone know how to get a real vector from one column of array in VBA? I've done the following steps:
'' read one column from 2D array
Dim ixy()
ixy = Application.Index(ts.Vertices, , 1)
And everything was looking all right until I wanted to ReDim the vector and add one more value to the end:
ReDim Preserve ixy(LBound(ixy) To UBound(ixy) + 1, 1 To 1)
ixy(UBound(ixy)) = ts.Vertices(1, 1)
This simply doesn't work because I cant ReDim non-last dimension of array. So how to obtain a vector by reading a column from an array? In Locals window the variable ixy looks + : ixy : : Variant(1 to 32, 1 to 1) so it's not 1d array.
I know how to obey this with loops but just want to find clear solution with minimum code. Any suggestions?
transpose. The firstixy = Application.Index(ts.Vertices, , 1)remains the same and its just needed to be transposed. What a simple solution!ixy = Application.Transpose(ixy)Many thanks for this suggestion!