 |
Anthony's VBA Forum Where the knowledge is shared |
|
|
View previous topic :: View next topic |
Author |
Message |
ddanmcgrew
Joined: 14 Nov 2008 Posts: 7 Location: Seattle
|
Posted: Sat May 23, 2009 4:56 pm Post subject: Passing and Returning Arrays |
|
|
I have written a great program to run in excell
It has a Main procedure which calls about 12 subroutines or functions
The program writes data to a worksheet in the subroutines
The subs then add and multiply the data of rows and columns
I need to do away the worksheet and write the data directly to an array
The array is called Table
The rows of the array will vary but columns will always be 13
I have added these next 3 lines of code and Table() to the parameter list of the calling and called function now I get an error "Type mismatch: array or user defined type expected"
I have also included the entire text of the called function "Elevation()"
I need to pass this Table array to about 10 subroutines some will just add data others will add sum values in a row and write them to the next column. Any ideas?
Also when I get the error message it highlights the array "Table()" in the paramter list of the called function "Elevation()"
Dim Table() As Double
q = (MaxPileLen / PileIncr) - 1
ReDim Table(q, 13) As Double
Call ClearTable
Call Elevation(MaxPileLen, PileIncr, Len1, Table())
Private Function Elevation(MaxPileLen, PileIncr, Len1, Table())
'Elevation() creates the first row on the workshhet Table the maximum pile length is
'segmented into fractions of a foot based on the users selection of pile delta
'incriment. a is a loop counter, c is max count, b is cell value
Dim b As Double
Dim a, c As Integer
b = Len1
c = (MaxPileLen / PileIncr) + 4
a = 0
Do While a <= c
b = Round(b, 2)
Worksheets("Table").Cells(a+3, 1) = b
Table(a , 1) = b
b = b - PileIncr
a = a + 1
Loop
End Function |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|