Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
TextBox on a userform - format to currency & percent
I have a userform with a textbox named Amount & another one named Rate is
there a way to format these textboxs as Currency and Percent? Thanks Terry |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
TextBox on a userform - format to currency & percent
There is no edit mask that you could apply, but you could change the format each
time you leave the textbox. Option Explicit Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) With Me.TextBox1 If IsNumeric(.Value) Then .Value = Format(.Value, "$#,##0.00") Else 'keep them in the textbox Cancel = True Beep End If End With End Sub If you to allow the users to hit the cancel key (if you have one) with an invalid entry in the textbox, then make sure that cancel key has its ..takefocusonclick property set to false. Terry wrote: I have a userform with a textbox named Amount & another one named Rate is there a way to format these textboxs as Currency and Percent? Thanks Terry -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
TextBox on a userform - format to currency & percent
Thanks Dave Works great - Terry
"Dave Peterson" wrote: There is no edit mask that you could apply, but you could change the format each time you leave the textbox. Option Explicit Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) With Me.TextBox1 If IsNumeric(.Value) Then .Value = Format(.Value, "$#,##0.00") Else 'keep them in the textbox Cancel = True Beep End If End With End Sub If you to allow the users to hit the cancel key (if you have one) with an invalid entry in the textbox, then make sure that cancel key has its ..takefocusonclick property set to false. Terry wrote: I have a userform with a textbox named Amount & another one named Rate is there a way to format these textboxs as Currency and Percent? Thanks Terry -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
UserForm TextBoxes - Is there a way to format as currency or perce | Excel Discussion (Misc queries) | |||
how do i format a textbox on a userform created in excel | New Users to Excel | |||
Need A date Mask format for a Textbox on UserForm | Excel Discussion (Misc queries) | |||
Currency Format on UserForm when opened! | Excel Discussion (Misc queries) | |||
userform textbox | Excel Worksheet Functions |