• Excel & VBA
Mortgage calculator (Visual Basic program)

“Loan” is an old program, I've ever made in VB5. This allows you full listings of such a mortgage loan. Both linear loans annuities can be calculated.

Screen

The program consists of a small form, when you leningsom, the term of the loan and the interest rate can fill, if you insert the date of the loan. In that case, the survey data also indicated.

lening

Overview

If you “Calculate” click, Get a complete overview of all installments of the loan, including the monthly charges, interest and debt by residual term.

lening-overzicht

Excel export

The list can also export to excel. For an example of a list in Excel: loan overzicht.xls

Code calculations

The manual calculation of annuïtenleningen is often a laborious karwijtje, while the coding of the calculation includes only a few dozen lines of code. This is the VB code where the actual calculation is performed.

 Public Function gfvIntrestAnnuiteit(Optional ByVal evvKapitaal As Variant, _
                        Optional ByVal evvAnnuiteit As Variant, _
                        Optional ByVal evvPerioden As Variant, _
                        Optional ByVal evvPercentage As Variant) As Variant
'-------------------------------------------
'Formula : K = Ann / a(n,p)
'pre : all optional invoerparam, except the unknown, are known;
'      of functie 'gfvGetValueIntrestTables' must be able to be called;
'post: The function gets the value of the unknown.
'-------------------------------------------
    If IsMissing(evvKapitaal) Then 'K = Ann / a(n,p)
        gfvIntrestAnnuiteit = CDec(evvAnnuiteit / gfvGetValueIntrestTables(evvPercentage, evvPerioden, True, True))
    ElseIf IsMissing(evvAnnuiteit) Then 'Ann = K / a(n,p)
        gfvIngfvIntrestAnnaiteit = CDecapitaaevvKapitaalalueIntrestTables(evvPercentage, evvPerioden, True, True)True  End If
End Function

Private Function gfvGetValueIntrestTables(ByVal evvPercentage As Variant, _
                    ByVal evvPerioden As Variant, _
                    Optional ByVal evvA As Boolean = False, _
                    Optional ByVal evvRecursie As Boolean = False) As Variant
'------------------------As Variant
'------------------------------------------#039;post: The funct'posthe value of S(n,p), A(n,p), with(n,p) of a(n,p).
"Possible error : err.number = 6 -> overflow
'-------------------------------------------
Dim lvvVar As Variant
    lvvVar = CDec((1 + (evvPercentage / 100)) ^ evvPerioden) '= S(n,p)
    If evvA Then lvvVar = 1 / lvvVar '= A(n,p)
    If evvRecursie And Not (evvPerioden = 0) Then 'limit recursion
        (lvvVar + gfvGetValueIntrestTables(evvPercentage, evvPerioden - 1, egfvGetValueIntrestTablesnevvPercentage
 evvPeriodenvvRecursie = False Then
        gfof aValueIntrestTables = CDec(lvvValvvVar End If
EndpFunction

Download

License

Code is in the public domain.

Related Articles

Comments (1)

  • MUCHAS GRACIAS POR TODO SON DE MUCHA AYUDA

Send your comment

  • RSS
  • LinkedIn
  • Twitter