Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Cells drop leading zeros from numbers

Is there a way to have a cell default to a text format without having
the spreadsheet already open?
The reason is that numbers that have a leading zeros are removed when
data is placed into the spreadsheet becuse the cell format is set to
General.

I have an application that will place a report into Excel when the
Excel icon is selected.


Thanks in Advance,

Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Cells drop leading zeros from numbers

SQLUser formulated on Sunday :
Is there a way to have a cell default to a text format without having
the spreadsheet already open?
The reason is that numbers that have a leading zeros are removed when
data is placed into the spreadsheet becuse the cell format is set to
General.

I have an application that will place a report into Excel when the
Excel icon is selected.


Thanks in Advance,

Mike


Use a custom format for cells to receive leading zeros. For example, to
display an 8 digit part number with leading zeros...

In the Custom format box type:
0000000#

Now, if you enter 27 in the cell, Excel displays it as 00000027.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Cells drop leading zeros from numbers

On Apr 10, 10:57*pm, GS wrote:
SQLUser formulated on Sunday :

Is there a way to have a cell default to a text format without having
the spreadsheet already open?
The reason is that numbers that have a leading zeros are removed when
data is placed into the spreadsheet becuse the cell format is set to
General.


I have an application that will place a report into Excel when the
Excel icon is selected.


Thanks in Advance,


Mike


Use a custom format for cells to receive leading zeros. For example, to
display an 8 digit part number with leading zeros...

* In the Custom format box type:
* * 0000000#

Now, if you enter 27 in the cell, Excel displays it as 00000027.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Is there a way of having the cell automatically have the 0000000# in
the Custom format when the spreadsheet is launched?


Thanks
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Cells drop leading zeros from numbers

SQLUser formulated on Monday :
Is there a way of having the cell automatically have the 0000000# in
the Custom format when the spreadsheet is launched?


Not normally, but you could make a template (XLT) with the formatting
(along with whatever else) already set up how you want. Then just reuse
the template and do 'SaveAs' to store it as a XLS.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Cells drop leading zeros from numbers

On Apr 11, 5:14*pm, GS wrote:
SQLUser formulated on Monday :

Is there a way of having the cell automatically have the *0000000# in
the Custom format when the spreadsheet is launched?


Not normally, but you could make a template (XLT) with the formatting
(along with whatever else) already set up how you want. Then just reuse
the template and do 'SaveAs' to store it as a XLS.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


The 0000000# works a number, but if the original value is 0555AA.
Then placed into EXCEL, the value goes to 555AA.

Is there a way of placing the 0 in front of 555AA like the 00000# does
for
a number?


Mike


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Cells drop leading zeros from numbers

0555AA is text data, not numeric.

Excel would treat as text and not drop the 0


Gord Dibben MS Excel MVP

On Mon, 11 Apr 2011 18:51:57 -0700 (PDT), SQLUser wrote:

The 0000000# works a number, but if the original value is 0555AA.
Then placed into EXCEL, the value goes to 555AA.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Cells drop leading zeros from numbers

SQLUser pretended :
On Apr 11, 5:14*pm, GS wrote:
SQLUser formulated on Monday :

Is there a way of having the cell automatically have the *0000000# in
the Custom format when the spreadsheet is launched?


Not normally, but you could make a template (XLT) with the formatting
(along with whatever else) already set up how you want. Then just reuse
the template and do 'SaveAs' to store it as a XLS.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


The 0000000# works a number, but if the original value is 0555AA.
Then placed into EXCEL, the value goes to 555AA.

Is there a way of placing the 0 in front of 555AA like the 00000# does
for
a number?


Mike


Entering '0555AA' into a cell formatted as 'General' displays as
"0555AA" on my machine. As Gord states, Excel sees this as text as soon
as you enter the first alpha (non-numeric) character. Why would you say
Excel would drop the leading zero?

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Cells drop leading zeros from numbers

On Apr 11, 9:31*pm, GS wrote:
SQLUser pretended :





On Apr 11, 5:14 pm, GS wrote:
SQLUser formulated on Monday :


Is there a way of having the cell automatically have the 0000000# in
the Custom format when the spreadsheet is launched?


Not normally, but you could make a template (XLT) with the formatting
(along with whatever else) already set up how you want. Then just reuse
the template and do 'SaveAs' to store it as a XLS.


--
Garry


Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


The 0000000# works a number, but if the original value is 0555AA.
Then placed into EXCEL, the value goes to 555AA.


Is there a way of placing the 0 in front of 555AA like the 00000# does
for
a number?


Mike


Entering '0555AA' into a cell formatted as 'General' displays as
"0555AA" on my machine. As Gord states, Excel sees this as text as soon
as you enter the first alpha (non-numeric) character. Why would you say
Excel would drop the leading zero?

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

- Show quoted text -


I thought I saw Excel drop the leading zero on 0555AA.

I rechecked and it did not.


Mike
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
Mix text and numbers with leading zeros Susan B Excel Worksheet Functions 3 September 17th 08 11:03 PM
How do I add 5 leading zeros to a group of numbers? hrc3aac Excel Discussion (Misc queries) 1 September 4th 08 09:53 PM
I need to drop some leading zeros Cheri Excel Discussion (Misc queries) 2 June 18th 08 08:36 PM
How do you delete leading zeros from numbers? emronexcel Excel Discussion (Misc queries) 2 March 21st 07 11:00 PM
sort numbers leading zeros l smith Excel Discussion (Misc queries) 2 June 8th 05 02:05 AM


All times are GMT +1. The time now is 03:59 PM.

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"