**VBA Exp**Â function is a built-in function in Excel, categorized under the **Math and Trig function**. In this article, we will show you what **Exp**Â **function** in **VBA** is and how to use it with examples.

**Table of Contents**hide

**Download Workbook**

You can download the free practice Excel workbook from here.

**Introduction to the EXP Function in VBA**

The **Exp**Â function in **VBA** returns a double value of the **exponential function e**** ^{x}** (mathematical

**constant e**, the base of natural logarithms) raised to a supplied power for the given value of

**x**.

**Syntax**

**Exp( number)**

**Argument**

Argument | Required/ Optional | Description |
---|---|---|

number |
Required | The power â€“ double or any valid numeric expression â€“ to raise the constant to.e |

**Return Value**

**A double numeric value.**

**5 Examples of VBA EXP Function in Excel**

In this section, we will show you how to use the **Exp**Â function in **VBA** with 5 easy examples.

**1. Find the Exponential Value of -5 with VBA in Excel**

Steps to find the **exponential value of -5** with **VBA** are given below.

**Steps:**

- Press
**Alt + F11**on your keyboard or go to the tab**Developer -> Visual Basic**to open**Visual Basic Editor**.

- In the pop-up code window, from the menu bar, click
**Insert -> Module**.

- Copy the following code and paste it into the code window.

```
'Find the Exponential value of -5
Sub ExpOfMinusFive()
Â Â Â Â 'Variable declaration
Â Â Â Â Dim iVal As Integer
Â Â Â Â Dim iResult As Double
Â Â Â Â iVal = -5
Â Â Â Â iResult = Exp(iVal)
Â Â Â Â MsgBox "The Exponential value of -5 is : " & iResult
End Sub
```

Your code is now ready to run.

- Press
**F5**on your keyboard or from the menu bar select**Run -> Run Sub/UserForm**. You can also just click on the**small Play icon**in the sub-menu bar to run the macro.

You will get the **exponential value of -5** in the Microsoft Excel message box.

**Read More: How to Use VBA IsNumeric Function (9 Examples)**

**2. Determine the Exponential Value of -0.3 with VBA EXP Function**

Steps to find the **exponential value of -0.3** with **VBA** are given below.

**Steps:**

- Same way as before, open
**Visual Basic Editor**from the**Developer**tab and**Insert**a**Module**in the code window. - In the code window, copy the following code and paste it.

```
'Find the Exponential value of -0.3
Sub ExpOfMinusZeroPointThree()
Â Â Â Â 'Variable declaration
Â Â Â Â Dim iVal As Integer
Â Â Â Â Dim iResult As Double
Â Â Â Â iVal = -0.3
Â Â Â Â iResult = Exp(iVal)
Â Â Â Â MsgBox "The Exponential value of -0.3 is : " & iResult
End Sub
```

Your code is now ready to run.

**Run**this code and you will get the**exponential value of -0.3**in the Excel message box.

**Read More: How to Use VBA Val Function in Excel (7 Examples)**

**3. Check the Exponential Value of 0 with VBA EXP Function**

Steps to find the **exponential value of 0** with **VBA** are given below.

**Steps:**

- Previously shown, open
**Visual Basic Editor**from the**Developer**tab and**Insert**a**Module**in the code window. - In the code window, copy the following code and paste it.

```
'Find the Exponential value of 0
Sub ExpOfZero()
Â Â Â Â 'Variable declaration
Â Â Â Â Dim iVal As Integer
Â Â Â Â Dim iResult As Double
Â Â Â Â iVal = 0
Â Â Â Â iResult = Exp(iVal)
Â Â Â Â MsgBox "The Exponential value of 0 is : " & iResult
End Sub
```

Your code is now ready to run.

**Run**this code and you will get the**exponential value of 0**in the Excel message box.

**Related Content:** **How to Use Fix Function in Excel VBA (4 Examples)**

**Similar Readings:**

**Use VBA Case Statement (13 Examples)****How to Use IsDate Function in VBA (3 Examples)****VBA If â€“ Then â€“ Else Statement in Excel (4 Examples)****How to Use VBA TimeValue Function (6 Relevant Examples)****Use VBA Mod Operator (9 Examples)**

**4. Compute the Exponential Value of 0.1 from a Cell in Excel**

To compute the **exponential value of 0.1**, we will **store the value in a cell** first then run the **VBA** code this time.

Notice in the above example, where we stored the value** 0.1** in **Cell B5**. We will extract the **exponential value of 0.1** in **Cell C5**.

**Steps:**

- Open
**Visual Basic Editor**from the**Developer**tab and**Insert**a**Module**in the code window. - In the code window, copy the following code and paste it.

```
Sub ExpOfZeroPointOne()
Â Â Â Â Range("C5").Value = Exp(Range("B5"))
End Sub
```

Your code is now ready to run.

**Run**this code and you will get the**exponential value of 0.1**in**Cell C5**.

**Read More:** **Excel Formula to Generate Random Number (5 examples)**

**5. Calculate the Exponential Value of a Range of Cells with VBA in Excel**

By following the code shown in the previous point, you can calculate the **exponential value for a range of cells** in Excel.

We will calculate the **exponential value** for the numbers shown in the picture above with the **VBA** code. You can store any numeric value in your dataset according to your need.

**Steps:**

- Open
**Visual Basic Editor**from the**Developer**tab and**Insert**a**Module**in the code window. - In the code window, copy the following code and paste it.

```
Sub ExpValueVBA()
Â Â Â Â Range("C5").Value = Exp(Range("B5"))
Â Â Â Â Range("C6").Value = Exp(Range("B6"))
Â Â Â Â Range("C7").Value = Exp(Range("B7"))
Â Â Â Â Range("C8").Value = Exp(Range("B8"))
Â Â Â Â Range("C9").Value = Exp(Range("B9"))
Â Â Â Â Range("C10").Value = Exp(Range("B10"))
End Sub
```

Your code is now ready to run.

**Run**this code and you will get the**exponential value**of all the numbers stored in the cells of the dataset in the cells mentioned in the code.

**Read More:** **Exponential Notation E in Excel & How to Turn Off Auto Scientific Notation!**

**Things to Remember**

- The value of constant
**e**is approximately**2.718282** - If the value of the argument
*number***709.782712893**,**VBA**will return a**run-time 6 error**. - If the value of the argument
is an*number***unrecognized number or string**, then**VBA**will throw a**run-time 13 error**. - This function integrates the action of the
**LOG function**and is sometimes assigned to as the anti-logarithm. - The
**LOG**function can be used to return the natural logarithm of a number.

**Conclusion**

This article showed you how to use the **VBA** **Exp **function in Excel. I hope this article has been very beneficial to you. Feel free to ask if you have any questions regarding the topic.

**Related Articles**

**How to Use ABS Function in Excel (9 Suitable Examples)****Excel VBA ASC() Function â€“ Get ASCII Value of Character****How to Create a Body Mass Index (BMI) Calculator in Excel Using VBA****44 Mathematical Functions in Excel (Download Free PDF)****How to Use Excel PI Function (7 Examples)****Solving equations in Excel (polynomial, cubic, quadratic, & linear)****How to Use POWER Function in Excel (5 Suitable Examples)**