Deuce Bucksman
Board Regular
- Joined
- Jan 17, 2011
- Messages
- 102
Hi,
I am trying to use the Payment function in VBA. The Macro runs but the answer is always zero unless I hard code the principal and interest portion of the code (I'm trying to use an inputbox). I was just wondering if maybe there was someone on here who might be able to tell me if I am missing a step? I really appreciate your help! Please see below for my steps.
I am trying to use the Payment function in VBA. The Macro runs but the answer is always zero unless I hard code the principal and interest portion of the code (I'm trying to use an inputbox). I was just wondering if maybe there was someone on here who might be able to tell me if I am missing a step? I really appreciate your help! Please see below for my steps.
Code:
Sub MacroTest1()
'
' MacroTest1 Macro
'This macro is to generate a text box for payments
Dim Principal As Variant
Dim InterestRate As Variant
Dim Payment As Variant
InputBox "Please enter principal balance", "Principal Balance" = Principal
InputBox "Please enter Interest Rate", "Interest Rate" = InterestRate
Payment = Pmt(InterestRate / 12, 360, Principal, 0)
MsgBox "Your payment is " & Payment
End Sub
Last edited by a moderator: