Specifying the Data Type for a Function's Result : Function Return « Language Basics « VBA / Excel / Access / Word






Specifying the Data Type for a Function's Result

 

Sub HowMuch()
    Dim num1 As Single
    Dim num2 As Single
    Dim result As Single

    num1 = 45.33
    num2 = 19.24
    result = MultiplyIt(num1, num2)

    MsgBox result
End Sub
Function MultiplyIt(num1, num2) As Integer
    MultiplyIt = num1 * num2
End Function

 








Related examples in the same category

1.return value from user-defined function
2.Return number from function
3.Passing Parameters and Returning Values
4.Return a string from funtion
5.Functions That Return an Array
6.Returning a sorted list