Using VB there are a couple of options

1.  If the number has a fixed length, for example 10 characters then you can initially set the number to "0000000000" & "1234" then use the right function to get the 10 char with leading zeros.  In this case the result would be "0000001234"
Num1="0000000000" & Num
Num2=right(Num1,10)

2.  Probably the best way is to use the format function
Num2=format(Num, "0000000000")
if Num = "1234" then the format function returns "0000001234"


Titmus, Steve wrote:
If the first cell value in the column is seen by Excel to be alpha, it will force additional cells in that column to be alpha only.  While creating your output file, prefix the at least the first value with a single quote.  The single quote will usually not display on the screen and wouldn't require an edit later to remove an alpha char.
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Paul Brungardt
Sent: Friday, January 26, 2007 12:29 PM
To: [email protected]
Subject: [Talk] .txt to .xls

I’m trying to find a way to convert text files with values that contain leading zeros into Excel files that will keep those leading zeros.  I can manually do this via Excel’s Import wizard but really need to find a way to script it.  Command line, VB, something other than manually!

 

Is there any hope?

 

Thanks!

Paul

 

Paul Brungardt

Clinical Analyst

HaysMedicalCenter

PH: 785-623-2196

PG: 785-650-5989

 


-- 
Neil Carman
Director Technical Development
Manigault & Associates LLC

http://www.m-allc.com
Work: (805) 680-5601
Fax:  (714) 968-5632

Reply via email to