Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

return value from private vba function

Status
Not open for further replies.

eHanSolo

Technical User
May 24, 2004
260
GB
hi there,

can someone tell me how i can return a value computed using another function?

thank you!


so i roughly have:

sub example()

call myFunction(var1,var2)

'want to be able to use the result from myFunction here...

end sub

private function myFunction(var1 as string, var2 as integer) as double

'some code here that does some random thing
myFunction = dataThatIWant

exit function

end function
 
Replace this:
call myFunction(var1,var2)
with something like this:
Dim myVar As Double
myVar = myFunction(var1,var2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
[tt]
sub example()
Dim nSomeResult as Double

nSomeResult = myFunction(var1,var2)

'want to be able to use the result from myFunction here...

MsgBox nSomeResult

end sub
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top