ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Forms - Formating fields (https://www.excelbanter.com/excel-programming/319181-user-forms-formating-fields.html)

Kathy - Lovullo

User Forms - Formating fields
 
I have a really easy question on a user form.

I have some fields on a form that I want to have the field reformat the
number entered into 2 decimals and to use commas (ie 1000 should re-format to
1,000.00) when the user exits the field.

What is the easiest way to do this?

Thanks!


Harald Staff

User Forms - Formating fields
 
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.Text = Trim$(Format$(Val(TextBox1.Text), "#,##0.00"))
End Sub

HTH. Best wishes Harald

"Kathy - Lovullo" skrev i melding
...
I have a really easy question on a user form.

I have some fields on a form that I want to have the field reformat the
number entered into 2 decimals and to use commas (ie 1000 should re-format

to
1,000.00) when the user exits the field.

What is the easiest way to do this?

Thanks!





All times are GMT +1. The time now is 07:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com