Greetings all,
I'm trying to get this to work properly, its to calculate profit and new account balance as u put the money in a bank for interest.
For example, if we have a balance of $1000 in our account and we wish to know how much we will have in the account after 3 months using an annual interest rate of 4.5% compounded monthly:
After first month: interest earned = $1000 * 4.5 / 100 / 12 = $3.75
new balance = $1000 + $3.75 = $1003.75
After second month: interest earned = $1003.75 * 4.5 / 100 / 12 = $3.76
new balance = $1003.75 + $3.76 = $1007.51
After third month: interest earned = $1007.51 * 4.5 / 100 / 12 = $3.78
new balance = $1007.51 + $3.78 = $1011.29
So, after 3 months we will have $1011.29 in our account and we will have earned $11.29.
My code is:
VB Code:
Private Sub cmdCalculate_Click() 'Proform calculations txtProfit.Text = Val(txtAccountbalance.Text) * 4.5 / 100 / Val(txtDuration.Text) txtNewbalance.Text = Val(txtProfit.Text) + Val(txtAccountbalance.Text) 'To correct values to 2 decimal places since it is money. txtNewbalance.Text = Format(txtNewbalance.Text, "currency") txtProfit.Text = Format(txtProfit.Text, "currency") End Sub
it doesnt work really well.. could someone tell me wad code to write?
My screenshot is attached below:
![]()




Reply With Quote