@Donald Foster
all variables to functions and sub's are passed by reference, meaning that they can and likely will be modified by the sub or function
I hope that this simple example will make it clear, note that the variables in the sub's declaration don't need to be the same as the variable that you intend to pass to the sub
there are two ways that you can call a sub
call times2 (m())
and
times2 m()
I prefer the latter
all variables to functions and sub's are passed by reference, meaning that they can and likely will be modified by the sub or function
I hope that this simple example will make it clear, note that the variables in the sub's declaration don't need to be the same as the variable that you intend to pass to the sub
there are two ways that you can call a sub
call times2 (m())
and
times2 m()
I prefer the latter
Code: (Select All)
Dim As Long m(10)
Dim As Long i
For i = 0 To 10
m(i) = i
Next
times2 m()
For i = 0 To 10
Print "i = "; i, "m("; i; ") = "; m(i)
Next
Sub times2 (mtwo() As Long)
Dim As Long i, u, l ' this are local variables
l = LBound(mtwo)
u = UBound(mtwo)
For i = l To u
mtwo(i) = 2 * mtwo(i)
Next
End Sub