On 2002-02-22 15:11, Russell Hauf wrote:
Mark is correct. And you can declare the type of the array in the argument list. In fact, it's a very good idea (unless you have an array with mixed types) - this way if you try to pass the wrong array to your function that takes an array, it won't work (and won't mess up your array or give an unexpected error). Here is a simple example:
Code:
Sub TestArray1()
Dim arr(1 To 2) As Integer
arr(1) = 4
arr(2) = 8
Call TestArray2(arr)
Debug.Print arr(1) & " " & arr(2)
End Sub
Sub TestArray2(arr() As Integer)
Dim intI As Integer
For intI = 1 To UBound(arr)
arr(intI) = arr(intI) * 2
Next intI
End Sub
You don't need to have the same name in both procedures/functions - I just used a short name.
Hope this gives you a better understanding,
Russell