Number Formats In A UserForm TextBox
Hey Tom,
Thanks for the answer and the lesson. It always helps to understand
how the answer works.
-Minitman
On Sat, 23 Oct 2004 10:20:07 -0400, "Tom Ogilvy"
wrote:
You don't need to double-double quote the $ sign
s# = 1234.56
? Format(s, """$""#,##0.00")
$1,234.56
? format(s,"$ #,##0.00")
$ 1,234.56
I added a space in the second, but that makes no difference: (just for
clarity)
? format(s,"$#,##0.00")
$1,234.56
so for the OP
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Textbox1.Text = format(cdbl(Textbox1.Text),"$ #,##0.00")
End Sub
or (cdbl is optional - excel will coerce the string)
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Textbox1.Text = format(Textbox1.Text,"$ #,##0.00")
End Sub
|