Anthony's VBA Forum Index Anthony's VBA Forum
Where the knowledge is shared
 Anthony's VBA Forum IndexHome Page
 Anthony's VBA Forum IndexForum Index
Log in to check your private messagesMessages
Log inLogin/Out

Quick Search

Advanced Search


Who's Online
[ Administrator ]
[ Moderator ]

Passing and Returning Arrays

Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA
View previous topic :: View next topic  
Author Message

Joined: 14 Nov 2008
Posts: 7
Location: Seattle

PostPosted: Sat May 23, 2009 4:56 pm    Post subject: Passing and Returning Arrays Reply with quote

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

End Function
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA All times are GMT - 4 Hours
Page 1 of 1

Jump to:  
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