Matrix Functions


Multiplying - MMULT

the matrices must both be square and of the same dimension


Public Sub Testing() 
Dim varray1 As Variant
Dim varray2 As Variant
Dim vreturn As Variant

    varray1 = Sheets("Sheet1").Range("B2:C3").Value
    varray2 = Sheets("Sheet1").Range("B5:C6").Value
   
    vreturn = Multiply_Matrices(varray1, varray2)
    
'call msgbox(vreturn
End Sub

Public Function Multiply_Matrices( _
    ByVal Arg1 As Variant, _
    ByVal Arg2 As Variant) As Variant

Dim vreturn As Variant

    vreturn = Application.WorksheetFunction.MMult(Arg1, Arg2)

    Multiply_Matrices = vreturn
End Function


When you take data directly off a worksheet by assigning a range to a Variant data type the array will be 1 based.
SS of watch window





Inverting - MINVERSE

the matrices must both be square and of the same dimension



Transposing - TRANSPOSE




© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext