As an example
Function myFunc(myVal)
myFunc = myVal * 2
End Function
Then you call like so
Msgbox myFunc(12)
Obviously the function should do more than that, but somewhere within it,
you have to pass the determined result back through the function name
(myFunc = myVal * 2) in my example. Usually, a variable is used within the
function to calculate that value and then pass it back through as the last
statement in the function.
The function can take multiple arguments, I only gave one in this simple
example.
You can also declare what type of variable the function returns, such as
Function myFunc(myVal) As Long
and also type the arguments so as to ensure data integrity in the caller,
such as
Function myFunc(myVal As Long) As Long