everyone, I got a strange problem, please help.
the error message is:
Run-time error ‘1004’
Unable to get the
MMultproperty of theWorksheetFunctionclass
1, I use a program name is "schedule" to automaticly run my VBA program everyday, but the VBA program will fail everyday, but when I control my "schedule program" to automatically run it again to try to reproduce this error, I can’t get it, it run smooth.
2, When this error occured, Excel will show [end] [debug] window, I click [debug] and press [F5], it run smooth; it supposes show error again if parameters for MMult are incorrect.
3, I have written a sub to dump my data which use in mmult, it are same in error occur and no error.
so, I can assume the two parameters for mmult are correct, but why I got the error message everyday?
this most hard thing is it is hard to reproduce this error.
code:
Public Function Regression(ByVal X As Variant, ByVal y As Variant)
writelog ("Regression")
writelog ("dump x")
Call dumpRange(X, 2)
writelog ("dump y")
Call dumpRange(y, 1)
Dim xtrans, temp, temp2, b
xtrans = Application.WorksheetFunction.Transpose(X)
temp = Application.WorksheetFunction.MMult(xtrans, X) ' occour error on this line
temp = Application.WorksheetFunction.MInverse(temp)
temp2 = Application.WorksheetFunction.MMult(xtrans, y)
b = Application.WorksheetFunction.MMult(temp, temp2)
Regression = b
End Function
X is a Range like this
1 0.34343323
1 1.32323323
1 1.21111221
1 0.33444232
. ......
Window 7 home preminum 64bit
office 2010 professional 64bit / 32bit sp1
I have reinstalled my OS and office, it work fine now.