How to prepare imported data for Excel to autosize properly width of the cell?

J

Jack

Hello,
When clicking on csv file containing data as below:
"AAA aaa","5552340553"
"BBB bbb","5552340553"
"CCC ccc","5552340553"
Excel application opens a spreadsheet but the phone numbers column is
squized and the numbers displayed look like below:
5.552E+09

5.552E+09

5.552E+09

btw, even the copy & paste operation does not do these numbers correctly

My question is:
How to prepare csv file that spreadsheet will display these numbers
correctly?

Jack
 
N

Nick Hodge

Jack

Take the csv extension off. (or rename it with a .txt extension). This will
then (File>open) run the text import wizard. In step 3 you can mark the
column as text. This will stop it

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
www.nickhodge.co.uk
 
D

Dave Peterson

Or just give that field a nicer format
Select the column
Format|cells|Number tab|Number (0 decimal places)
 
J

Jack

<Sorry for sending that to the wrong place>

Thank you but I cannot do that.
Starting Excel and displaying default spreadsheet is done automatically by
my vbasic application.
I am using Excel automation to do that.
What I need is just to show any spreadsheet containing sample data as shown
before, but the width of column should autosize to width of data.
Maybe I can do that another way, without loading a data but inserting the
data after opening a blank sheet?
Jack
 
N

Nick Hodge

Jack

If you are using automation in VB then use the OpenText method of the
workbook to do as I suggested before. I don't think the width of columns
will matter as I think it is Excel's interpretation of the data in the csv
so as soon as it opens it's set

In the method, check out the DataType parameter which is an array of
settings showing how the parsed data should be treated.

Past this I don't know another way

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
www.nickhodge.co.uk
 

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