Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rick has answered your question but another possible way would be to change
the ByVal to ByRef, but ONLY if it's OK to have the variable return to the calling function changed, eg Function Test(ByRef x As Long) x = 12 End Function Private Sub CommandButton1_Click() Dim x As Long Call Test(x) ' or simply Test x MsgBox "x is " & x End Sub Note the Dim x As Long to match the declaration of the argument. Regards, Peter T "Eng Teng" wrote in message ... How do I get x value from Function Test() in CommandButton1_Click() function ? Function Test(ByVal x As Integer) x = 12 End Function Private Sub CommandButton1_Click() para_ret = Test(x) MsgBox "x is " & para_ret End Sub Regards, Tee |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
parameter | Excel Programming | |||
How to choose if I use a parameter or not in a parameter query | Excel Discussion (Misc queries) | |||
What does this parameter mean? | Excel Programming | |||
Working with Arrays, pasing from function to function | Excel Programming | |||
optional parameter | Excel Programming |