VBA Exp Function

VBA Exp Function

Overview of VBA Exp Function:


VBA Exp function is categorized as Math(Mathematical) & Trig function. This is a built-in Excel VBA Function. This function returns an exponential value for a specified number(e raised to a power x). The constant e value is approximately 2.718282. If x value is greater than 709.782712893, returns an error.

We can use this function in Excel and VBA. This function we use in either procedure or function in a VBA editor window in Excel. We can use this VBA Exp Function in any number of times in any number of procedures or functions. In the following section we learn what is the syntax and parameters of the Exp function, where we can use this Exp Function and real-time exampleS in Excel VBA.

Syntax of VBA Exp Function

The syntax of the Exp Function in VBA is

Exp(Number)

The Exp function returns e raised to a power x.

Parameters or Arguments:

The Exp function has one argument in Excel VBA.
where
Number:The Number is a required parameter. It represents a number or numeric value. We use this parameter to find exponential value.

Where we can apply or use VBA Exp Function?

We can use this Exp Function in VBA MS Office 365, MS Excel 2016, MS Excel 2013, 2011, Excel 2010, Excel 2007, Excel 2003, Excel 2016 for Mac, Excel 2011 for Mac, Excel Online, Excel for iPhone, Excel for iPad, Excel for Android tablets and Excel for Android Mobiles.

Example 1: Find an Exponential value(-3)

Here is a simple example of the VBA Abs function. This below example finds an exponential value(-3).

'Find An Exponential value(-3)
Sub VBA_Exp_Function_Ex1()

    'Variable declaration
    Dim iValue As Integer
    Dim dResult As Double
    
    iValue = -3
        
    dResult = Exp(iValue)
        
    MsgBox "An Exponential value of -3 is : " & dResult, vbInformation, "VBA Exp Function"
    
End Sub

Output: Here is the screen shot of the first example output.
VBA Exp Function

Example 2: Find an Exponential value(0)

Here is a simple example of the VBA Abs function. This below example finds an exponential value(0).

'Find An Exponential value(0)
Sub VBA_Exp_Function_Ex2()

    'Variable declaration
    Dim iValue As Integer
    Dim dResult As Double
    
    iValue = 0
        
    dResult = Exp(iValue)
        
    MsgBox "An Exponential value of 0 is : " & dResult, vbInformation, "VBA Exp Function"
    
End Sub

Output: Here is the screen shot of the second example output.
VBA Exp Function

Example 3: Find an Exponential value(3)

Here is a simple example of the VBA Abs function. This below example finds an exponential value(3).

'Find An Exponential value(3)
Sub VBA_Exp_Function_Ex3()

    'Variable declaration
    Dim iValue As Integer
    Dim dResult As Double
    
    iValue = 3
        
    dResult = Exp(iValue)
        
    MsgBox "An Exponential value of 3 is : " & dResult, vbInformation, "VBA Exp Function"
    
End Sub

Output: Here is the screen shot of the third example output.
VBA Exp Function

Example 4: Find an Exponential value(6.5)

Here is a simple example of the VBA Abs function. This below example finds an exponential value(6.5).

'Find An Exponential value(6.5)
Sub VBA_Exp_Function_Ex4()

    'Variable declaration
    Dim iValue As Double
    Dim dResult As Double
    
    iValue = 6.5
        
    dResult = Exp(iValue)
        
    MsgBox "An Exponential value of 6.5 is : " & dResult, vbInformation, "VBA Exp Function"
    
End Sub

Output: Here is the screen shot of the third example output.
VBA Exp Function

Instructions to use Macro Codes

Here are the step by step instructions to use the VBA Exp function in Excel VBA.

  • Open an Excel workbook.
  • Press Alt+F11 to open VBA Editor window.
  • Go to Insert menu and click on module from the available options.
  • Copy above specified macros to the VBA editor.
  • Select any procedure from above codes and click on ‘Run’ command or use Keyboard shortcut ‘F5’.

List of VBA Functions:

Please click on below link to go back to see all List of VBA Functions.

VBA Math(Mathematical) & Trig Functions List of VBA Functions

Leave a Comment

Your email address will not be published. Required fields are marked *