View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Returning a value forom a Module to a Userform

You mean something like this ?

'<Userform code
Private Sub CommandButton1_Click()
MsgBox MyFunction(20, 10)
End Sub
'</Userform code

'<Module code
Public Function MyFunction(Arg1 As Long, Arg2 As Long) As Long
MyFunction = Arg1 * Arg2
End Function

'</Module code

NickHK

"CSUS_CE_Student" wrote in message
...
I am trying to make a userform to return some data from the spreadsheet

after
the analysis is done in a public Sub. How do I call the variable from

the
public module to the userform?