Formatting Text Boxes in UserForms

  • Thread starter Thread starter KG
  • Start date Start date
K

KG

When designing text boxes for data entry, can the text
box controls on the UserForm be assigned number
formatting properties?

For example, how would I arrange for data in TextBox1 to
be in % with one decimal point, preferrably with a
trailing % sign?
 
You can format the value that goes in the textbox the way you want. Maybe
something like:

Option Explicit
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsNumeric(Me.TextBox1.Value) Then
Me.TextBox1.Value = Format(Me.TextBox1.Value / 100, "#0.0%")
End If
End Sub
 
I'm going to give it a try. Thanks!
-----Original Message-----
You can format the value that goes in the textbox the way you want. Maybe
something like:

Option Explicit
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsNumeric(Me.TextBox1.Value) Then
Me.TextBox1.Value = Format(Me.TextBox1.Value / 100, "#0.0%")
End If
End Sub



--

Dave Peterson
(e-mail address removed)
.
 

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

Back
Top