The code below calculates retirement funds. The application will allow you to enter a beginning balance, monthly deposit, and annual interest rate, and it will then calculate the total funds available at retirement for the number of years you specify plus it will display the results for the Fund by years in a table.
1. I want to add a button to calculate how many years it will take you to become a millionaire and display the result using a message box.
2. I want to display the total retirement funds for the specified
number of years for a range of interest rates in another table.
Can you help me out to write a code for 1 and 2?

Private Sub cmdCalculate_Click()
'declare variables
Dim curMonthlyDeposit As Currency
Dim sngMonthlyInterestRate As Single
Dim intYears As Integer
Dim intY As Integer
Dim intM As Integer
Dim curRetirementFund As Currency
Dim strFundinYears As String

'Assign the intial values

curRetirementFund = CCur(txtBalance.Text)
curMonthlyDeposit = CCur(txtDeposit.Text)
sngMonthlyInterestRate = CSng(txtInterestRate) / 100 / 12
intYears = CInt(txtYears)
strFundinYears = "Years" & vbTab & "Fund" & vbCrLf

'Calculate retirement fund in years using nested loops
lblFundInY.Caption = "Fund by years" & _
" (" & txtInterestRate.Text & "% annual interest rate)"

For intY = 1 To intYears
For intM = 1 To 12
curRetirementFund = (curRetirementFund + curMonthlyDeposit)
* (1 + sngMonthlyInterestRate)
Next intM
strFundinYears = strFundinYears & intY & vbTab & _
Format(curRetirementFund, "currency") + vbCrLf

Next intY

'Dispaly the result in the retirement fund text box
txtFund.Text = Format(curRetirementFund, "Currency")

'Display the results in the fund by years table
txtFundInY.Text = strFundinYears

End Sub