Matrix Math with VBA (System of Linear Equations)
Two things:
The same rule applies as in actual mathematics: B
must be a vertical array for matrix multiplication to be possible in your case. Declare it as
Dim B(0 To 1, 0 To 0) As Single
and initialize it accordingly. Also, just declare
Dim X As Variant
since the MMult
returns a Variant array. This is what was causing your original error.