leo27
07-08-2006, 12:35 PM
Please help me find the answer. When I run it, I get the message "type mismatch; array or user-defined type expected"
thank you
Leopold:hi:
Norie
07-08-2006, 12:37 PM
Can you explain what you are actually trying to do and where you get the error?
leo27
07-08-2006, 12:43 PM
I want to pass those arrays into the Eliminate Sub to perform calculations inside there, have you seen the code? You can not do anything (debugging) it just stops there
Norie
07-08-2006, 12:45 PM
Yes I've seen the code.
But there's no data in the attachment.:eek:
leo27
07-08-2006, 12:57 PM
Now I am concerned HOW to pass the arguments. I eliminated calculations for simplicity
mdmackillop
07-08-2006, 02:07 PM
Hi Leo
Dim e11(), e12(), e13(), e14(), e15() As Double
This is only declaring e15() as double, the remainder are variants. You need to add "as Double" after each item.
mdmackillop
07-08-2006, 02:12 PM
Option Explicit
Sub Main()
Dim p As Double
Dim i, j, k As Integer
Dim Imax, Jmax, Kmax As Integer
'.....
Dim e11() As Double, e12() As Double, e13() As Double, _
e14() As Double, e15() As Double ' matrix coeff
Imax = 12 'number of cells in i direction
Jmax = 0 'number of cells in j direction
Kmax = 0 'number of cells in k direction
ReDim e11(Imax, Jmax, Kmax), e12(Imax, Jmax, Kmax), _
e13(Imax, Jmax, Kmax), e14(Imax, Jmax, Kmax), _
e15(Imax, Jmax, Kmax) ' matrix coeff
i = 1 'skip the boundary cells
j = 0
k = 0
For k = 0 To Kmax
For j = 0 To Jmax
For i = 1 To Imax - 1
e11(i, j, k) = 2 * p
e12(i, j, k) = 3 * p
e13(i, j, k) = 4 * p
e14(i, j, k) = 4 * p
e15(i, j, k) = 4 * p
Next i
Next j
Next k
Eliminate 10, 0, 0, e11(), e12(), e13(), e14(), e15()
End Sub 'End of Main
Sub Eliminate(Imax As Integer, Jmax As Integer, Kmax As Integer, _
e11() As Double, e12() As Double, e13() As Double, _
e14() As Double, e15() As Double)
End Sub
Norie
07-08-2006, 02:19 PM
MD
Good catch, I think I was caught up with trying to work out what the OP is actually trying to do.:)
leo27
07-08-2006, 02:36 PM
Dear mdmackillop and Norie,
thank you very much - I rush to test it. Since this is my first thread - do I close it? How?:clap:
leo27
07-08-2006, 03:03 PM
Thank you! it works! I just had to move "ReDim..." below assigned values of i,j,k :clap2:
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.