Using VBA, I multiplied 2 arrays as below:

Dim X(1 To 3, 1 To 3) As Single
Dim Y(1 To 3, 1 To 3) As Single
Dim Z() As Single


Z = Application.WorksheetFunction.MMult(X, Y)

The matrix multiplication did not work with Z As Single, only when it
was Variant. With Z() As Single I got a Type mismatch error, a similar thing happened if I defined the dimensions of Z (correctly). Why is this?

Is there a way round this if I want to multiply 2-D arrays using Mmult or some other method?

Variant arrays take up too much memory.

Many Thanks