ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format Column to display leading zeros. (https://www.excelbanter.com/excel-programming/408172-format-column-display-leading-zeros.html)

Glenn Buchanan

Format Column to display leading zeros.
 
Using an external program with a language very similar to VB I have a script
that uses CreateObject to create a new workbook and fill with data. All well
and good. I have one column that is filled mostly with numbers where I need
to see any leading zeros.
How would I format this column before filling it? Changing the format after
the data is entered results in missing leading zeros.
With xl
..ActiveSheet.Columns("F:F").NumberFormat = ?

Regards,
Glenn

GTVT06

Format Column to display leading zeros.
 
On Mar 22, 1:15*pm, Glenn Buchanan <Glenn
wrote:
Using an external program with a language very similar to VB I have a script
that uses CreateObject to create a new workbook and fill with data. All well
and good. I have one column that is filled mostly with numbers where I need
to see any leading zeros.
How would I format this column before filling it? Changing the format after
the data is entered results in missing leading zeros.
With xl
.ActiveSheet.Columns("F:F").NumberFormat = ?

Regards,
Glenn

The ZipCode format alows leading 0's Example:
With xl
.ActiveSheet.Columns("F:F").NumberFormat = "0000"

JLGWhiz

Format Column to display leading zeros.
 
Look he

http://support.microsoft.com/kb/81518

"Glenn Buchanan" wrote:

Using an external program with a language very similar to VB I have a script
that uses CreateObject to create a new workbook and fill with data. All well
and good. I have one column that is filled mostly with numbers where I need
to see any leading zeros.
How would I format this column before filling it? Changing the format after
the data is entered results in missing leading zeros.
With xl
.ActiveSheet.Columns("F:F").NumberFormat = ?

Regards,
Glenn


Peter T

Format Column to display leading zeros.
 
as text -

rng.NumberFormat = "@"

Regards,
Peter T

"Glenn Buchanan" <Glenn wrote in message
...
Using an external program with a language very similar to VB I have a

script
that uses CreateObject to create a new workbook and fill with data. All

well
and good. I have one column that is filled mostly with numbers where I

need
to see any leading zeros.
How would I format this column before filling it? Changing the format

after
the data is entered results in missing leading zeros.
With xl
.ActiveSheet.Columns("F:F").NumberFormat = ?

Regards,
Glenn




Glenn Buchanan[_2_]

Format Column to display leading zeros.
 
Thanks to all who replied to my post.
After experimenting I found Peter's suggestion worked the best for my
variable length data.
Thanks again.
Glenn.

"Peter T" wrote:

as text -

rng.NumberFormat = "@"

Regards,
Peter T

"Glenn Buchanan" <Glenn wrote in message
...
Using an external program with a language very similar to VB I have a

script
that uses CreateObject to create a new workbook and fill with data. All

well
and good. I have one column that is filled mostly with numbers where I

need
to see any leading zeros.
How would I format this column before filling it? Changing the format

after
the data is entered results in missing leading zeros.
With xl
.ActiveSheet.Columns("F:F").NumberFormat = ?

Regards,
Glenn






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

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