ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cells drop leading zeros from numbers (https://www.excelbanter.com/excel-programming/444430-cells-drop-leading-zeros-numbers.html)

SQLUser

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

GS[_2_]

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



SQLUser

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

GS[_2_]

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



SQLUser

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

Gord Dibben[_2_]

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.


GS[_2_]

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



SQLUser

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


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com