Here is a little function that calulates the compound interest of an amount, over the specified period.
Function CompoundInterest(cStartAmount As Currency, fInterestPerPeriod
As Single, lPeriods As Long) As Currency
Dim i As Long
Dim cTotal As Currency
cTotal = cStartAmount
For i = 1 To lPeriods
cTotal = cTotal + (cTotal * (fInterestPerPeriod))
Next i
CompoundInterest = cTotal - cStartAmount
End Function
Private Sub cmdCalculate_Click()
'// 100 = starting amount
'// 0.1 = 10% Interest per period
'// 2 = 2 periods
MsgBox CompoundInterest(100, 0.1, 2)
End Sub
Comments