View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Parameter Pasing ?

You can't have a MAIN subroutine with paramters. A main subroutine is the
first subroutine called from a workbook. You have to use ActiveCell to get
the current cell data in you are using Command button on a worksheet. If you
ae using a userform then read one of the Oleojects (textbox, listbox,
combobox) to get you parameter.

"Eng Teng" wrote:

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