Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform textbox number formats PhilM Excel Discussion (Misc queries) 2 June 7th 06 11:08 AM
userform textbox Phil Excel Worksheet Functions 5 January 16th 05 06:59 PM
Textbox in userform shaharul[_6_] Excel Programming 3 April 15th 04 12:54 PM
Formatting number in a UserForm TextBox John Pierce Excel Programming 3 January 26th 04 04:57 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"