View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_8_] Nigel[_8_] is offline
external usenet poster
 
Posts: 172
Default Help with Textbox formatting

Put your formatting in the UserForm_Initialize() event eg

Sub UserForm_Initialize()
TextBox1.Value = Format(TextBox1.Value, "$#,##0")
End Sub

Cheers
Nigel

"bruce forster" wrote in message
...
I have several textboxes in userforms which either need to be currency or

%. I have tried the following code but it only formats correctly when a
change is made. Once the form is closed and reopened the formatting is
gone. I hope someone can help.

Sub TextBox1_OnChange
TextBox1.Value = Format(TextBox1.Value, "$#,##0")
End Sub

In advance thanks.