PC Review


Reply
Thread Tools Rate Thread

Convert number to text and add comma separator for thousands

 
 
prahz
Guest
Posts: n/a
 
      7th Dec 2006
I have a Text Box in a User Form that I am creating. The Text Box's
value is set to a number without decimals.

For example:
Dim rents As Long
rents = 4102
rentsTxtBox.Value = rents

So when the number passes to the Text Box, I want it to display like
this: 4,102. Basically, is there an vba function for excel that
converts a number to a string and then adds the comma separator for
thousands? If not what code would I use to do this?


Thanks.

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      7th Dec 2006
rentsTxtBox.Value = Format(rents,"#,##0")

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"prahz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a Text Box in a User Form that I am creating. The Text Box's
> value is set to a number without decimals.
>
> For example:
> Dim rents As Long
> rents = 4102
> rentsTxtBox.Value = rents
>
> So when the number passes to the Text Box, I want it to display like
> this: 4,102. Basically, is there an vba function for excel that
> converts a number to a string and then adds the comma separator for
> thousands? If not what code would I use to do this?
>
>
> Thanks.
>



 
Reply With Quote
 
prahz
Guest
Posts: n/a
 
      7th Dec 2006
Thank you!

Bob Phillips wrote:
> rentsTxtBox.Value = Format(rents,"#,##0")
>
> --
> ---
> HTH
>
> Bob
>
> (change the xxxx to gmail if mailing direct)
>
>
> "prahz" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I have a Text Box in a User Form that I am creating. The Text Box's
> > value is set to a number without decimals.
> >
> > For example:
> > Dim rents As Long
> > rents = 4102
> > rentsTxtBox.Value = rents
> >
> > So when the number passes to the Text Box, I want it to display like
> > this: 4,102. Basically, is there an vba function for excel that
> > converts a number to a string and then adds the comma separator for
> > thousands? If not what code would I use to do this?
> >
> >
> > Thanks.
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert the Thousands Separator (comma) in Excel? Highlander Microsoft Excel Programming 6 15th Jun 2007 08:22 PM
use comma separator for thousands in pivot tables =?Utf-8?B?Sy5Ba2VydmFsbA==?= Microsoft Access 0 30th May 2007 12:39 AM
Convert a number to text and add a comma separator for thousands prahz Microsoft Excel Programming 2 7th Dec 2006 06:19 PM
How to convert Decimal number with comma(,) as decimal separator to dot(.) Domac Microsoft Access Reports 1 10th May 2006 01:04 PM
thousands comma separator in VBA Wendy Francis Microsoft Excel Misc 2 25th Oct 2005 01:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:08 AM.