How to use Loan Calculator through Excel Office VBA?
Tags: touseloancalculator, vbamacros
Published: 2021-09-15 02:18:29

---
title: How to use Loan Calculator through Excel Office VBA?
published: true
date: 2021-09-14 12:54:25 UTC
tags: ToUseLoanCalculator,VBAMacros
canonical_url: https://geekexcel.com/how-to-use-loan-calculator-through-excel-office-vba/
---

In this tutorial, we will guide you to learn how to use the **loan calculator** through Excel Office VBA. Let’s get them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## User Form

It is used to **enter the specific details in the data,** which is basically used by the users who are not friendly with Excel.

## Create the User form for Interest amount calculation

- Firstly, in the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic option](https://geekexcel.com/wp-content/uploads/2020/09/11-3.png)<figcaption>Select the Visual Basic option</figcaption>

- Now, in the Project Explorer, you have to **insert a User Form** , then **insert 3 label boxes, 3 text boxes and one command button**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Userform-1.png)<figcaption>UserForm</figcaption>

- You need to **double-click on Command** button to **assign the Macro**.
- You have to  **copy and paste**  the following code.

```

Private Sub CommandButton1_Click()
Dim Amount, rate, duration, interest As Single
Dim erow As Integer
erow = Worksheets("Sheet1").Cells(Rows.count, 1).End(xlUp).Offset(1, 0).Row
Amount = Val(TextBox1.text)
Cells(erow, 1).Value = Amount
rate = Val(TextBox2.text) / 100
Cells(erow, 2).Value = rate
Cells(erow, 2).Value = Cells(erow, 2) * 100 & "%"
duration = Val(TextBox3.text)
Cells(erow, 3).Value = duration
interest = ((Amount * (1 + rate) ^ duration) - Amount)
Cells(erow, 4).Value = interest
End Sub

```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-37-1024x657.png)<figcaption>Save the Code</figcaption>

- You have to **insert a button** to **open the user form**.
- In Excel Worksheet, you need to ** ** click on the  **Insert ** icon and select  **Button ** option.

![](https://geekexcel.com/wp-content/uploads/2021/09/Insert-a-button.png)<figcaption>Insert a Button</figcaption>

- Then, you need to  **right-click**  on it and click on  **assign macro**  and then click on  **new**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Click-on-Assign-Macro-1.png)<figcaption>Assign Macro</figcaption>

- Now, **Visual Basic Editor** will open.
- You have to  **copy and paste**  the following code.

```

Sub Button2_Click()

UserForm1.Show

End Sub

```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-1-1.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- You need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Now, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://geekexcel.com/wp-content/uploads/2021/09/Run-the-Code-18.png)<figcaption>Run the Code</figcaption>

- After that, you will receive the **userform1** in the Microsoft Excel.

![](https://geekexcel.com/wp-content/uploads/2021/09/UserForm1-1024x405.png)<figcaption>UserForm1</figcaption>

- You have to enter **amount** , and **%age** , and then **Duration**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Enter-the-data-1.png)<figcaption>Enter the data</figcaption>

- Now, you need to click on **Command button** , **entries** will get entered to the **defined cells**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output-11.png)<figcaption>Output</figcaption>

- Finally, it will calculate the **interest amount in D column**.

## A Brief Synopsis

Here, we have explained the step-by-step procedure on how to use the **loan calculator** through Excel Office VBA. Make use of this. Please share your worthwhile  **feedback**  in the below  **comment**  section. To learn more, check out our website **[Geek Excel](https://geekexcel.com/)!! **

**Read Also:**

- [Fetch Values From Cells for Calculation in Excel Office 365!!](https://geekexcel.com/fetch-values-from-cells-for-calculation-in-excel-office-365/)
- [Excel Formulas to Calculate the Interest Rate for Loan ~ Easy Tricks!!](https://geekexcel.com/excel-formulas-to-calculate-the-interest-rate-for-loan/)
- [Calculate Loan Interest in Given Year ~ Simple Tips!!](https://geekexcel.com/excel-formulas-to-calculate-loan-interest-in-given-year/)
- [Excel Formulas to Calculate the Payment for a Loan ~ Useful Tricks!!](https://geekexcel.com/excel-formulas-to-calculate-the-payment-for-a-loan/)
- [Excel Formulas to Calculate the Original Loan Amount ~ Quickly!!](https://geekexcel.com/excel-formulas-to-calculate-the-original-loan-amount/)