Thread: arrays
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Edward Ulle Edward Ulle is offline
external usenet poster
 
Posts: 92
Default arrays

Since parameters are passed to subroutines and functions by reference
you can simply pass the array as parameter. I believe this will work
for any data type.

See the following example.

Option Explicit

Sub Test()

Dim dblArray(5) As Double

PopulateArray dblArray

MsgBox dblArray(2)

End Sub

Private Function PopulateArray(inArray() As Double)

Dim i As Integer
Dim x As Double

x = 1#
For i = 0 To 5
inArray(i) = x
x = x + 1#
Next

End Function




*** Sent via Developersdex http://www.developersdex.com ***