Here's how a function works. Lets say you want a function to add two numbers together and return the result.
Code:
Function fcnAddTwo(a as long, b as long) as long
fcnAddTwo = a + b
End Function
This says that the two numbers to be added are both long and the result returned will be long.
Notice that the function sets the value to be returned to its own name.
Now to use the function you could use:
Code:
sub cmdButton_Click()
dim num1 as long
dim num2 as long
dim rslt as long
num1 = 5
num2 = 10
rslt = fcnAddTwo(num1, num2)
debug.print rslt
End Sub
Notice that rslt is set to the value of the function - it gets the value returned.
Hope this helps.