View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
terry terry is offline
external usenet poster
 
Posts: 193
Default 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