MissouriTiger
Programmer
I would be grateful if someone would help me with at least one of the following dilemmas. I'm listing them in order of importance.
1. I've spent hours trying to get this right. What am I doing wrong, why am I not getting the right answer? I'm lost. This is my first time using the Pmt Function. Here's my code for a loan paymment calculator:
Dim dblIntRate As Double, dblPrincipal As Double, intTerm As Integer
dblIntRate = 7 + (lstInterest.ListIndex * 0.25) 'Saves value of interest rate selected by user
dblPrincipal = Val(txtPrincipal.Text) 'Saves value of loan
Select Case True
'User selects optionbutton for loan period in months
Case optTerm(0).Value
intTerm = 24
Case optTerm(1)
intTerm = 36
Case optTerm(2)
intTerm = 48
Case optTerm(3)
intTerm = 60
End Select
lblPayment.Caption = Pmt(Rate:=dblIntRate / 12, NPer:=intTerm, PV:=dblPrincipal)
2. Isn't there some way to determine which Option button is selected, incorporated right into a variable initialization statement, rather than with a selection structure (as above). I tried the following syntax to no avail:
intTerm = 24 + (optTerm(Index) * 12)
OptTerm is the name of my Option button Array. It seems like a sensible statement to me, but I keep getting an error and it's telling me that "Index" is an undeclared variable (due to Option Explicit). What the?!?!?!?!
Any suggestions?
[sig][/sig]
1. I've spent hours trying to get this right. What am I doing wrong, why am I not getting the right answer? I'm lost. This is my first time using the Pmt Function. Here's my code for a loan paymment calculator:
Dim dblIntRate As Double, dblPrincipal As Double, intTerm As Integer
dblIntRate = 7 + (lstInterest.ListIndex * 0.25) 'Saves value of interest rate selected by user
dblPrincipal = Val(txtPrincipal.Text) 'Saves value of loan
Select Case True
'User selects optionbutton for loan period in months
Case optTerm(0).Value
intTerm = 24
Case optTerm(1)
intTerm = 36
Case optTerm(2)
intTerm = 48
Case optTerm(3)
intTerm = 60
End Select
lblPayment.Caption = Pmt(Rate:=dblIntRate / 12, NPer:=intTerm, PV:=dblPrincipal)
2. Isn't there some way to determine which Option button is selected, incorporated right into a variable initialization statement, rather than with a selection structure (as above). I tried the following syntax to no avail:
intTerm = 24 + (optTerm(Index) * 12)
OptTerm is the name of my Option button Array. It seems like a sensible statement to me, but I keep getting an error and it's telling me that "Index" is an undeclared variable (due to Option Explicit). What the?!?!?!?!
Any suggestions?
[sig][/sig]