
Number_of_periods = Range("B4").Value * Range("B5").ValueĮmi = WorksheetFunction.Pmt(monthly_rate, number_of_periods, -loan_amount) Monthly_rate = Range("B6").Value / Range("B5").Value
#Visual basic for excel courses code#
Give the button macro name btnCalculateEMI_ClickĮnter the following code Dim monthly_rate As Single, loan_amount As Double, number_of_periods As Single, emi As Double It’s the actual loan amountĬreate the GUI using excel cells as shown belowĪdd a command button between rows 7 and 8 It’s the loan term multiplied by number of payments per year “nper” it is the total number of payments.It’s the interest rate divided by the number of payments per year The PMT function works as follows =PMT(rate,nper,pv) You can use the PMT function to compute the above. The good news is excel already took care of the above problem. The above formula is complex and can be written in excel. The following image shows the formula for calculating EMI. It’s the monthly amount that you repay when you get a loan. EMI is the acronym for Equated Monthly Instalment. In this tutorial exercise, we are going to create a simple program that calculates the EMI. Right click on button 1 and select edit textĬongratulations, you just created your first VBA program in excel Step by step example of creating a simple EMI calculator in Excel.Your complete code window should now look as follows “ MsgBox “Hello ” + name” calls the built in function MsgBox that display Hello and the entered name.The entered name is then stored in the name variable.

#Visual basic for excel courses how to#
Now we will demonstrate how to program in VBA programming language. You will now be able to see the DEVELOPER tab in the ribbon VBA Hello World! As you work with VBA Excel, you will be required to declare variables too just like in algebra classes

They can also be changed to say 4 and 2 respectively. In this expression, x and y are variables. Variable – in high school we learnt about algebra.The following basics will help you get started. Introduction to Visual Basic for Applicationsīefore we can write any code, we need to know the basics first. The advantage of this approach is you can leverage the powerful features of excel in your own custom programs. Read the article on Macros for more information on how you can achieve this.įor business use, you can create complete powerful programs powered by excel and VBA. Personal & Business Applications of VBA in Excelįor personal use, you can use it for simple macros that will automate most of your routine tasks. It also allows you to enhance Excel functionality by making it behave the way you want. VBA is easy to learn, and it has easy to use User Interface in which you just have to drag and drop the interface controls. VBA enables you to use English like statements to write instructions for creating various applications.
