Function Array Conversions Class

VariantVectorToMatrixColumn

Overlays a one-dimensional Variant array onto a Column of a two-dimensional Variant array. The destination array must already have been dimensioned.

Signature (Visual Basic / VBA)

Public Function VariantVectorToMatrixColumn( _
      ByRef rTo() As Variant _
    , ByRef vFm() As Variant _
    , ByVal vColumnNumber As Variant _
    ) As Boolean

Code Examples

    Assuming
       Static avarTable(0 To 2, 0 To 2) As Variant
       ' Column--v  v--Row
       avarTable(1, 1) = "From"
       avarTable(2, 1) = "feet"
       avarTable(1, 2) = "To"
       avarTable(2, 2) = "meters"
       Static avarNew(1 To 2) As Variant
       avarNew(1) = "gallons"
       avarNew(2) = "liters"
    for example
       ? VariantVectorToMatrixColumn(avarTable(), avarNew(), 2)
       True
       ? VariantMatrixToString(avarTable(), " ", vbCrLf)
       From gallons
       To liters
    rTo(ColumnNumber, X) = vFm(X)

Parameters

Parameter Description
rTo Two-dimensional array of Variants in which one of the columns will be overlaid by vFm. 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.
vFm One-dimensional Variant array containing the values that will replace the column in rTo.
vColumnNumber Number of the Column in rTo whose values will be replaced.

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.