Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Stopping Excel from stripping off leading zeros?

I make many spreadsheets that contain a CUSIP column, which can have
leading zeros. Excel helpfully strips these off, rendering them
unreadable.

Normally I address this by putting a quote in front of the number to
force it to be a string. However, I notice that the quote is actually
exported if you save it as CSV.

So I can't use a Format to do this because that gets killed off in the
CSV form and the zeros get stripped, and I can't use the quote because
it doesn't! Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Stopping Excel from stripping off leading zeros?

I assume you mean you prefix with an apostrophe.

Depending on what you are doing overall, you may find it helps first to
format the cells as Text

rng.NumberFormat = "@"

Regards,
Peter T


"Maury Markowitz" wrote in message
...
I make many spreadsheets that contain a CUSIP column, which can have
leading zeros. Excel helpfully strips these off, rendering them
unreadable.

Normally I address this by putting a quote in front of the number to
force it to be a string. However, I notice that the quote is actually
exported if you save it as CSV.

So I can't use a Format to do this because that gets killed off in the
CSV form and the zeros get stripped, and I can't use the quote because
it doesn't! Any suggestions?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Stopping Excel from stripping off leading zeros?

I assume you mean you prefix with an apostrophe.

Depending on what you are doing overall, you may find it helps first to
format the cells as Text

rng.NumberFormat = "@"

Regards,
Peter T


"Maury Markowitz" wrote in message
...
I make many spreadsheets that contain a CUSIP column, which can have
leading zeros. Excel helpfully strips these off, rendering them
unreadable.

Normally I address this by putting a quote in front of the number to
force it to be a string. However, I notice that the quote is actually
exported if you save it as CSV.

So I can't use a Format to do this because that gets killed off in the
CSV form and the zeros get stripped, and I can't use the quote because
it doesn't! Any suggestions?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Stopping Excel from stripping off leading zeros?

I do not believe excel strips the leading zero's when saving to CSV. I'm
using version 2000 (poor me). When I open the CSV in notepad, it shows the
zeros.

I used both the Edit....Cells...Format and the TEXT(a1, "0000000") option.
In both cases the zeros were inside the CSV.

"Maury Markowitz" wrote:

I make many spreadsheets that contain a CUSIP column, which can have
leading zeros. Excel helpfully strips these off, rendering them
unreadable.

Normally I address this by putting a quote in front of the number to
force it to be a string. However, I notice that the quote is actually
exported if you save it as CSV.

So I can't use a Format to do this because that gets killed off in the
CSV form and the zeros get stripped, and I can't use the quote because
it doesn't! Any suggestions?

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
Excel Leading Zeros Brandy Excel Discussion (Misc queries) 3 October 1st 07 07:20 PM
how to keep all leading zeros when stripping dashes from txt num Sue Excel Discussion (Misc queries) 3 June 18th 07 11:29 PM
Stop Excel from stripping out leading zeros when saving as CSV MattM Excel Discussion (Misc queries) 4 June 26th 06 11:35 AM
Excel Leading Zeros [email protected] Excel Discussion (Misc queries) 3 January 17th 06 06:59 PM
save text field w/ leading zeros in .csv format & not lose zeros? Ques Excel Discussion (Misc queries) 1 May 4th 05 06:21 PM


All times are GMT +1. The time now is 08:51 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"