I have a user form to simply calculate the future value of a payment series.
One text box allows the user to specify the interest rate as a percentage. Upon exit, I am able to format the value as a percent.
In my main sub, I am trying to assign the value of the text box to a variable as a decimal.
The line assigning a value to the variable interest is triggering the run-time error '13' Type Mismatch.
I want the user to see percent formatting in the text box, but I want to be able to use the value as a decimal for calculation purposes.
I am using Excel 2010 and Windows 7.
Thanks for your help!
Jay
One text box allows the user to specify the interest rate as a percentage. Upon exit, I am able to format the value as a percent.
Code:
Private Sub TB_interest_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TB_interest.Value = Format(TB_interest.Value, "percent")
End Sub
In my main sub, I am trying to assign the value of the text box to a variable as a decimal.
Code:
Private Sub CB_ok_Click()
Dim payment As Single
Dim time As Integer
Dim interest As Single
payment = TB_payment.Value
time = TB_time.Value
interest = Val(TB_interest.Value) / 100
End Sub
The line assigning a value to the variable interest is triggering the run-time error '13' Type Mismatch.
I want the user to see percent formatting in the text box, but I want to be able to use the value as a decimal for calculation purposes.
I am using Excel 2010 and Windows 7.
Thanks for your help!
Jay