Article ID: 138536
Article Last Modified on 1/11/2001
Private Sub Form_Click
Dim Fmt As Variant, FVal As Variant, Guess As Variant, PVal As Variant,_
TotPmts As Variant, Payment As Variant, PayType As Variant, _
APR As Variant
Static NewGuess
NewGuess = 0.02
Const ENDPERIOD = 0, BEGINPERIOD = 1 ' When payments are made.
Const MB_YESNO = 4 ' Define Yes/No buttons.
Const ID_NO = 7 ' Define No as a response.
On Error GoTo Errhandler
Fmt = "##0.00" ' Define percentage format.
FVal = 0 ' Usually 0 for a loan.
Guess = 0.1 ' Guess of 10 percent.
PVal = 81709.07 '
Payment = 720.45
TotPmts = 700
PayType = BEGINPERIOD
APR = (Rate(TotPmts, -Payment, PVal, FVal, PayType, Guess) * 12) * 100
MsgBox "Your interest rate is " & Format(CInt(APR), Fmt) & "percent."
Exit Sub
Errhandler:
NewGuess = NewGuess + 0.01
If (NewGuess > 1#) Then
MsgBox "Calculation of rate not possible-please change Total payments"
Exit Sub
End If
Guess = NewGuess
Resume
End Sub
Dim Fmt As Variant, FVal As Variant, Guess As Variant, PVal As Variant,_ TotPmts As Variant, Payment As Variant, PayType As Variant, _ APR As Variant Const ENDPERIOD = 0, BEGINPERIOD = 1 ' When payments are made. Const MB_YESNO = 4 ' Define Yes/No buttons. Const ID_NO = 7 ' Define No as a response. Fmt = "##0.00" ' Define percentage format. FVal = 0 ' Usually 0 for a loan. Guess = 0.1 ' Guess of 10 percent. PVal = 81709.07 ' Payment = 720.45 TotPmts = 700 PayType = BEGINPERIOD APR = (Rate(TotPmts, -Payment, PVal, FVal, PayType, Guess) * 12) * 100 MsgBox "Your interest rate is " & Format(CInt(APR), Fmt) & "percent."
Keywords: kbprb KB138536