Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    5

    Unanswered: Matrix multiplication in VBA using arrays

    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

    X=.....
    Y=.....

    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

  2. #2
    Join Date
    Jun 2006
    Posts
    5
    Have you tryed defining Z() As Double ?
    Bye, Brainjar

  3. #3
    Join Date
    Jun 2006
    Posts
    5
    Brainjar, I defined Z() As Double, but still got a Type Mismatch Error.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •