Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting textboxes

Status
Not open for further replies.

Enkay62

Programmer
Sep 5, 2003
78
IT
Hi.
In vba for excel 2000 I've a userform with some textboxes containing numbers.
I used "Afterupdate" event to format a textbox but, when the userform is loaded again the textbox is not formatted.
So I tried to use "Initialize" event with the foll. code
UserForm1.TextBox1.Value = Format (UserForm1.TextBox1.Value, "##,##0")
but it doesn't work.

Where am I wrong?

Thank you in advance for your answers.
Regards.
Nick.
 
have you a form_load sub to do this?

alternatively, can you not set an imput mask on the physical textbox to always by in the format you want?
 
Hi Fred Perry.
Yes I have a Form_load sub. (I triede to put my code in that sub either but...nothing.
Sorry, but cannot understand the second part of your reply.
What do you mean?
Thank you very much.
Nick.
 
if you go to the form in design view, and click on the textbox and go to properties, there is an input mask property.

if you put:

>##,##0

then the user can only type data in this format into the box.

hope it helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top