Textbox appearances. Format as $ and %. How?

C

Corey

I have a few text boxes on a userform that display values for allowances,
however $10.00 displays as 10 with no "$" and no 2 decimal values.
Also a 0.09 is displayed in another textbox, however i want it displayed as
"9%".

How do i change the format apperances of these?

Corey....
 
G

Guest

Corey,

You can use the on_exit event of the textbox as below

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.Text = Format(TextBox1.Text, "#,##0.00")
End Sub

Changing the format to your desired format.
 
C

Corey

What about this one i'm now stuckon?

Private Sub TextBox1_Change()
ActiveSheet.Select
With Me.TextBox1
End With
End Sub

Want it to display $xx.xx
Only displays x

Corey....
 
T

Tom Ogilvy

Change fires on every entry made in a textbox - if the user is typing in an
answer, trying to format in the change event would be difficult.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.TextBox1
.Text = Format(.Text,"$ #0.00")
End With
End Sub
 
C

Corey

Tom,
Do i remove the change code,
and
then insert the exit code.
I ge tthe same result.
Just the amount, and no $xx.xx

Corey....
 

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

Top