Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Force a Number to be Formatted as Text (keep leading 0's)

But if you had turned on the macro recorder and formatted a cell manually,
then turned it off and looked at the code you would have seen how to do it.
Just a reminder that the macro recorder does have its uses.

--
Regards,
Tom Ogilvy


"swaterhouse" wrote in message
...
Thanks, never would have guessed that and certainly couldn't find it in

any docs.
--
Scott


"Alex Guardiet" wrote:

Hi,

supposing G is the column you want to format, all you need is this line:

Columns("G:G").NumberFormat = "@"

Regards,

Alex

"swaterhouse" wrote:

I need to set a column so the formatting is set to "Text" even if the

value is numeric because the numeric value may have leading zeros that need
to be there. I have used the NumberFormat property on the Colums collection
to format numbers with specific numbers of decimals but cannot figure out
how to set it to text. I tried settimg the value with a leading space but
that didn't work.
--
Scott



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Force a Number to be Formatted as Text (keep leading 0's)

I have to do the same thing but rather than read as text, I...

variable = Format(variable, "0000000000")

Mar

--
Message posted from http://www.ExcelForum.com

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
Columns formatted As Dates Are Exported as a Number to Text Rich Locus Excel Discussion (Misc queries) 1 February 7th 10 08:00 PM
Formatted number gets truncated when saved as tab delimited text Prashant Excel Discussion (Misc queries) 0 October 5th 06 09:02 PM
Use formatted text instead of number value... Rod Janson New Users to Excel 3 September 5th 06 02:51 PM
How do I force a leading zero character eg 07817 m800afc Excel Discussion (Misc queries) 3 March 22nd 06 07:27 PM
How do I force leading zeros in an Excel cell? EricKei Excel Discussion (Misc queries) 2 June 15th 05 08:28 PM


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

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

About Us

"It's about Microsoft Excel"