dennygibson
02-18-2019, 01:56 PM
My journey from Fortran to VBA has been interesting … here's something I ran into today:
'I have two arrays (D and F) in my code that should be vectors:
Dim D(1 to 2) As Double
Dim F(1 to 2) As Double
Dim C(1 To 2, 1 To 2)
when I try to execute the following:
C(1, 1) = 1#
C(1, 2) = 0#
C(2, 1) = 0#
C(2, 2) = 1#
D(1) = x1 + 3 * x2
D(2) = 2 * x1 + 2 * x2
F = WorksheetFunction.MMult(C, D)
I get "Can't assign to array" from the compiler … when I had the D and F as Dim F(1 To 2, 1 To 1) and
Dim D(1 To 2, 1 To 1) it all worked … can someone explain why?
Thanks!
Denny
'I have two arrays (D and F) in my code that should be vectors:
Dim D(1 to 2) As Double
Dim F(1 to 2) As Double
Dim C(1 To 2, 1 To 2)
when I try to execute the following:
C(1, 1) = 1#
C(1, 2) = 0#
C(2, 1) = 0#
C(2, 2) = 1#
D(1) = x1 + 3 * x2
D(2) = 2 * x1 + 2 * x2
F = WorksheetFunction.MMult(C, D)
I get "Can't assign to array" from the compiler … when I had the D and F as Dim F(1 To 2, 1 To 1) and
Dim D(1 To 2, 1 To 1) it all worked … can someone explain why?
Thanks!
Denny