Userform Help

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

I have created a couple userform the calculate a formula,
based on inputed info from the user. In certain situations
the answer needs to be a Dollar value and in others the
calculated number only needs to display 4 numbers past the
decimal point.

How do I cange this code to reflect the two seperate
situations.

Private Sub CommandButton1_Click()
sStr = "#" & Trim(TextBox1) & "#" & Trim(TextBox2) & "#" &
_ Trim(TextBox3) & "#" & Trim(TextBox4) & "#"
sStr1 = Application.Substitute(Application.Substitute
(sStr, "#", ""), ".", "")
If InStr(sStr, "##") = 0 And IsNumeric(sStr1) Then
TextBox5 = (CDbl(TextBox1) * CDbl(TextBox2)) / (CDbl
(TextBox3) * CDbl(TextBox4) * 12)
End If

End Sub

Any help is better than what I got.
Thanks
Pete W
 
dblVal = (CDbl(TextBox1) * CDbl(TextBox2)) / _
(CDbl(TextBox3) * CDbl(TextBox4) * 12)

TextBox5 = Format(dblVal,"$ #,##0")

or

Textbox4 = Format(dblVal,"0.0000")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Arbitrary data to Textboxes in UserForm 4
Reselect a TextBox 5
User Type vs. Variable 1
Force proper case on user form text box 7
Help 8
Input box question 6
Create a public variable 4
Userform and Goal Seek 1

Back
Top