Compound Interest Calculator (1 Viewer)

newbE

Registered User.
Local time
Today, 04:13
Joined
Mar 3, 2014
Messages
12
Hi,
I am fairly new to this and I am trying to create a form that will calculate compound interest. [FONT=&quot]To encourage the user to invest more money for longer periods, also display the consequences if the investment were for twice and three times the amount and years. [/FONT]I have attached the form. I believe I need to use a For ... Next Loop, but I need some help executing code. Please Help. Thanks

Example:
Total to invest: 1000
Number of years: 5
Interest Rate 7.5

Calculate Earnings (button)

Answer (label): $1453.00

This is the code I have so far.

Private Sub cmdCalculate_Click()
Dim intAmount As Currency, intYear As Integer, intRate As Integer, varAmount As Currency
intAmount = Val(Me.txtAmount)
intYear = Val(Me.txtYear)
intRate = Val(Me.txtRate)
varAmount = txtAmount + (txtAmount * (txtRate / 100 / 12))
Dim intI As Currency
For intI = varAmount To (txtYear) * 12
Next intI
Me.lblTotal.Caption = "At the end of " & txtYear & " years" & vbCrLf _
& "the total savings will be " & intI
Me.lblTotal2.Caption = "If you invest " & txtAmount & " for " & txtYear * 2 & " years" & vbCrLf _
& "the total savings will be " & intI
Me.lblTotal3.Caption = "If you invest " & txtAmount & " for " & txtYear * 3 & " years" & vbCrLf _
& "the total savings will be " & intI
End Sub
 

Attachments

  • Form.jpg
    Form.jpg
    53 KB · Views: 210
Last edited:

newbE

Registered User.
Local time
Today, 04:13
Joined
Mar 3, 2014
Messages
12
Thanks for the reply. I have posted more information about what I am trying to do. I need interest to be calculated monthly.
 

plog

Banishment Pending
Local time
Today, 06:13
Joined
May 11, 2011
Messages
11,638
The link I provided has a function to account for the number of times to compound. This time when I ran your numbers through it and compounded it monthly I got the results you were looking for. Follow the link, implement that function. Still, no for loop necessary.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 12:13
Joined
Sep 12, 2006
Messages
15,638
plog is right. compounding monthly effectively just changes the interest rate, and number of periods.

all financial functions are fairly straightforward to do.
 

newbE

Registered User.
Local time
Today, 04:13
Joined
Mar 3, 2014
Messages
12
Thanks for the replies. This is an assignment that I am working on.
I unfortunately do have to use a loop to calculate the original problem, 2 times the number of years, and three times the number of years as instructed by my professor. Check out the attached form. Anyway, I think I'm gaining... maybe.
 

Users who are viewing this thread

Top Bottom