Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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_OnChang TextBox1.Value = Format(TextBox1.Value, "$#,##0" End Su In advance thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What's this OnChange event?
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OnChange seems to fire the formatting once the textbox is changed
|
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For activeX controls, to the best of my knowledge,
There is no onchange event. There is a change event and a click event. -- Regards, Tom Ogilvy "bruce forster" wrote in message ... OnChange seems to fire the formatting once the textbox is changed |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Okay. But when I used a _Change code the formatting works but then when I close the userform and reinitialize it goes away. what should I do??
|
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did you try Nigel's suggestion?
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "bruce forster" wrote in message ... Okay. But when I used a _Change code the formatting works but then when I close the userform and reinitialize it goes away. what should I do?? |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A textbox is always plain text. Try putting that line in the initialize
event of the form. --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
formatting a textbox | Excel Discussion (Misc queries) | |||
Textbox Formatting | Excel Discussion (Misc queries) | |||
textbox formatting | Excel Discussion (Misc queries) | |||
TextBox Formatting | Excel Discussion (Misc queries) | |||
TextBox Formatting | Excel Programming |