Macro coding for PMT Formula

JaydeepBijlani

New Member
Joined
Aug 2, 2018
Messages
2
Hello I am trying below VB code to execute PMT formula to calculate EMI but getting error "Unable to get pmt property of the worksheetFunction class"

Sub EMI()
Dim Loan_Amount As Double
Dim EMI As Double
Dim Rate As Double
Dim Payment_Per_Year As Double
Dim Tenure As Double
monthly_rate = Cells(7, 4).Value / Cells(8, 4).Value
Loan_Amount = Cells(5, 4).Value
Payment_Per_Year = Cells(8, 4).Value
number_of_periods = Cells(6, 4).Value * Cells(8, 4).Value
EMI = Application.WorksheetFunction.PMT(monthly_rate / 100, number_of_periods, Loan_Amount)
Range("D9").Value = EMI


End Sub

Please let me know if i am making any mistake
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try running the code again. This time, though, when the error occurs, click on Debug. The line causing the error should be highlighted in yellow. Now, place your cursor over each of the variables (ie. monthly_rate, number_of_periods, and Loan_Amount), and see what each of them have been assigned. Maybe this might provide you with some clues.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top