![]() |
Run-time error '1004' . Please help. Request for immediate attent
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 |
Run-time error '1004' . Please help. Request for immediate attent
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 |
All times are GMT +1. The time now is 02:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com