Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Formatting a column - needs refresh?

Hi,
I am exporting stuff out from a vb program to a .csv file, then optionally
opening this in excel for the user to view. One of the columns of
information contains phone numbers, but when excel opens the file it sees it
as a number and shows it wrong. i.e. 447768123456 comes out as 4.47769E+11.
I have put the following line in my code:

.Columns(2).Select
.Selection.NumberFormat = "@"

which works, except for the cell to refresh to look correct I need to click
on the (correctly displayed) number in the formula bar at the top of the
screen, at which point the number displayed in the cell appears correctly.
How can I automate this step?
Thanks,
James.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting a column - needs refresh?

Try this instead...

Columns(2).Select
Selection.NumberFormat = "#

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formatting a column - needs refresh?

with Columns(2)
.NumberFormat = "000000000000"
.Autofit
End With

--
Regards,
Tom Ogilvy
"James" wrote in message
...
Hi,
I am exporting stuff out from a vb program to a .csv file, then optionally
opening this in excel for the user to view. One of the columns of
information contains phone numbers, but when excel opens the file it sees

it
as a number and shows it wrong. i.e. 447768123456 comes out as

4.47769E+11.
I have put the following line in my code:

.Columns(2).Select
.Selection.NumberFormat = "@"

which works, except for the cell to refresh to look correct I need to

click
on the (correctly displayed) number in the formula bar at the top of the
screen, at which point the number displayed in the cell appears correctly.
How can I automate this step?
Thanks,
James.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Formatting a column - needs refresh?


"Tom Ogilvy" wrote in message
...
with Columns(2)
.NumberFormat = "000000000000"
.Autofit
End With


Thanks for the help folks, all working now!


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
How do I refresh a column after changing the formatting? Angie Excel Worksheet Functions 1 May 22nd 08 01:20 AM
Conditional Formatting - Date Refresh Kara Excel Worksheet Functions 3 June 7th 07 09:56 PM
Maintain pivot table formatting after refresh dan Excel Discussion (Misc queries) 0 January 10th 07 03:09 PM
formatting on a pivot report refresh Kathie Excel Discussion (Misc queries) 2 January 24th 06 07:58 PM
Retain PivotTable formatting after "Refresh Data" Joel 48371 Excel Discussion (Misc queries) 1 April 1st 05 09:48 PM


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