Reputation: 2647
This is what I was trying:
Calling the function from the module:
LastWorkingDay = IsBusinessDay(Yesterday)
Function:
Public Function IsBusinessDay(Yesterday As Variant) As Date
...
InterestingVariable = #20/02/2014#
End Function
I would like to return InterestingVariable and assign it to LastWorkingDay. There is no return statement in VBA, so how do you decide what you want to return. Or, how do you call a function to return a particular variable calculated in the function In my case it would "InterestingVariable".
Upvotes: 1
Views: 95
Reputation:
return
in VBA is the function name and = <return value>
so for example
Public Function MyFunction() as String
MyFunction = "returned from MyFunction"
End Function
so MsgBox MyFunction
returns a String
returned from MyFunction
Upvotes: 2