rforster10
New Member
- Joined
- Mar 11, 2022
- Messages
- 2
Hello Everyone,
When I use the RATE formula in my Excel spreadsheet it works:
=RATE(360,3419.64612201533,-425000,75377.9008606371)
The formula gives me 0.760897490282994% which is correct for my purposes.
However, when I try to code the Rate function using VBA in my macro, I get a runtime '5' error. See below for code.
I need to use a principal amount that is negative in VBA for my purposes. Can someone please help me?
Thanks!
When I use the RATE formula in my Excel spreadsheet it works:
=RATE(360,3419.64612201533,-425000,75377.9008606371)
The formula gives me 0.760897490282994% which is correct for my purposes.
However, when I try to code the Rate function using VBA in my macro, I get a runtime '5' error. See below for code.
VBA Code:
Sub LoanCalculator()
Dim periods As Double
Dim payment As Double
Dim principal As Double
Dim futureValue As Variant
Dim interestRate As Double
periods = 360
payment = 3419.64612201533
principal = -425000
futureValue = 75377.9008606371
interestRate = Rate(periods, payment, principal, futureValue)
Debug.Print(interestRate)
End Sub
I need to use a principal amount that is negative in VBA for my purposes. Can someone please help me?
Thanks!