Cells drop leading zeros from numbers

S

SQLUser

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
 
G

GS

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.
 
S

SQLUser

SQLUser formulated on Sunday :





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
 
G

GS

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.
 
S

SQLUser

SQLUser formulated on Monday :


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
 
G

Gord Dibben

0555AA is text data, not numeric.

Excel would treat as text and not drop the 0


Gord Dibben MS Excel MVP
 
G

GS

SQLUser pretended :
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?
 
S

SQLUser

SQLUser pretended :









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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top