Signature (Visual Basic / VBA)
Public Function VariantMatrixColumnToVector( _
ByRef rTo() As Variant _
, ByRef vFm() As Variant _
, ByVal vColumnNumber As Variant _
) As Boolean
Code Example
Assuming
Static avarTable(0 To 2, 0 To 2) As Variant
' Column--v v--Row
avarTable(1, 1) "James"
avarTable(2, 1) "Johnson"
avarTable(1, 2) "Sam"
avarTable(2, 2) "Smith"
Dim avarFirst() As Variant
for example
VariantMatrixColumnToVector(avarFirst(), avarTable(), 1) = True
leaves
LBound(avarFirst) = 0
UBound(avarFirst) = 2
IsEmpty(avarFirst(0)) = True
avarFirst(1) = "James"
avarFirst(2) = "Sam"
Parameters
| Parameter | Description |
|---|---|
| rTo | Dynamic, one-dimensional Variant array that will receive the values. rTo must be dynamic so that this function can re-dimension it appropriately. rTo need not be initialized (with ReDim) before being passed to this function. rTo will be re-dimensioned from LBound(vFm, 2) to UBound(vFm, 2). |
| vFm | Two-dimensional array of Variants from which one of the columns will be copied. Within this array, dimension #1 represents the Column and dimension #2 represents the Row. This is because the number of rows changes most frequently and the upper bound of the last dimension (representing the row) can be re-dimensioned directly by Visual Basic. |
| vColumnNumber | Number of the Column whose values will be copied. |
Return Value
Function does nothing and returns False if vColumnNumber is Null or cannot be fixed-up to a number. Function currently returns True in all other cases.