The VBA Exp function returns the value of the exponential function ex at a supplied value of x.
I.e. the function returns the mathematical constant e (the base of the natural logarithm) raised to a supplied power.
The syntax of the Exp function is:
Where the supplied Number is the power that you want to raise the constant e to.
The following VBA code shows three examples of the VBA Exp function.
' Calculate ex for three values of x.
Dim val1 As Double
Dim val2 As Double Dim val3 As Double
val1 = Exp( -0.1 )
' The variable val1 is now equal to 0.90483741803596.
val2 = Exp( 0 )
val3 = Exp( 1.5 )' The variable val2 is now equal to 1.0. ' The variable val3 is now equal to 4.48168907033806. |
In the above VBA code:
If the Number that is supplied to the Exp function is greater than 709.782712893, you will get the error:
If the Exp function is supplied with a value that cannot be interpreted as a number, it will return the error: