
12-22-2006, 02:33 AM
|
|
Newcomer
|
|
Join Date: Dec 2006
Posts: 2
|
|
vba ByRef and ByVal Variable Declaration
|
Hi VBA Gurus
couls anyone kindly explain to me what this code does if suppliied with the following values:1,2,3,4,5
'example on passing arguments byref declaration
Function test2(a As Integer)
a = a - 2
If a = 0 Or a < 0 Then
test2 = 2
Exit Function
End If
test2 = test2(a) * (a + 10)
End Function
Sub calc2()
Dim aa As Integer
aa = InputBox("enter integer ", "integer", 0)
MsgBox aa
MsgBox test2(aa)
MsgBox aa
End Sub
i can not seem to figure out how the outcomes are being calculated
thanks
|
|