Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
can somebody tell me how to correct this code. I get runtime 1004 error or
type mismatch error(where is the type mismatch!!!). the MMult function doe not get activated in my VBE. rewuest for immediate attention. Option explicit Option Base 1 Sub mmatrixmulttest() Dim q, ran, t, X As Double Dim Randommat() As Variant Dim CMAT() As Variant CMAT = Application.Range("VC") X = UBound(CMAT, 1) Dim matrixinter() As Variant Dim matrixinter2() As Variant ReDim matrixinter(X, X) ReDim matrixinter2(X, X) ReDim CMAT(X, X) ReDim Randommat(1, X) For q = 1 To X ran = Application.WorksheetFunction.NormSInv(Rnd()) Randommat(1, q) = ran * t Next q Dim Rmattranspose() As Variant ReDim Rmattranspose(X, 1) Rmattranspose = Application.WorksheetFunction.Transpose(Randommat) With Application matrixinter = .MMULT(Rmattranspose, CMAT) matrixinter2 = .MMULT(CMAT, CMAT)' this multiplication also does not 'work.Typemismatch is the error End With End Sub -- beetal |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
X should be a Long q should be a Long t is not defined in your code, so is probably always 0. This will make Randommat 0. The notation Dim q, ran, t, X As Double will make X a double but the rest variants. You want Dim q as Long, ran as double, t as double, X As Long see if any of that helps regards Paul On Sep 10, 8:22*am, BEETAL wrote: can somebody tell me how to correct this code. I get runtime 1004 error or type mismatch error(where is the type mismatch!!!). the MMult function doe not get activated in my VBE. rewuest for immediate attention. Option explicit Option Base 1 Sub mmatrixmulttest() Dim q, ran, t, X As Double Dim Randommat() As Variant Dim CMAT() As Variant CMAT = Application.Range("VC") X = UBound(CMAT, 1) Dim matrixinter() As Variant Dim matrixinter2() As Variant ReDim matrixinter(X, X) ReDim matrixinter2(X, X) ReDim CMAT(X, X) ReDim Randommat(1, X) For q = 1 To X ran = Application.WorksheetFunction.NormSInv(Rnd()) Randommat(1, q) = ran * t Next q Dim Rmattranspose() As Variant ReDim Rmattranspose(X, 1) Rmattranspose = Application.WorksheetFunction.Transpose(Randommat) With Application matrixinter = .MMULT(Rmattranspose, CMAT) matrixinter2 = .MMULT(CMAT, CMAT)' this multiplication also does not 'work.Typemismatch is the error End With End Sub -- beetal |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 general odbc error excel 2003 vba | Excel Programming | |||
Run time error 1004 Object defined error | Excel Programming | |||
Run Time Error 1004: Application or Object Defined Error | Excel Programming | |||
Run Time 1004 Error: Application or Object Difine Error | Excel Programming | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming |