Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Reformatting of cells on requery of sql source

Is there any way to prevent excel from reformatting the cell widths when the data is refreshed from the datasource. I have a worksheet that automatically refreshes when it is opened, but it reformats all of the column headers to fit the longest piece of data for that column.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Reformatting of cells on requery of sql source

Hi needhelp,

You can set the AdjustColumnWidth property of the QueryTable to False, which
tells Excel not to update column widths on each refresh of the QueryTable.
I think you need to do this only once, so you could execute the following
statement from the Immediate Window in the VBE:

Sheets("Sheet1").QueryTables(1).AdjustColumnWidth= False

Then save your workbook...next time you open, the column widths should not
be adjusted.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


needhelp wrote:
Is there any way to prevent excel from reformatting the cell widths
when the data is refreshed from the datasource. I have a worksheet
that automatically refreshes when it is opened, but it reformats all
of the column headers to fit the longest piece of data for that
column.


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
Reformatting Cells tommygun715 Excel Discussion (Misc queries) 5 May 19th 10 04:56 PM
Excel 2007 reformatting cells Bzltyr Excel Discussion (Misc queries) 8 December 16th 09 04:51 PM
Reformatting numbers in cells Joanne New Users to Excel 1 July 30th 08 05:23 PM
Reformatting text in cells RFJ Excel Worksheet Functions 3 April 9th 07 06:41 PM
Macro for reformatting cells Gina_Louisville Excel Worksheet Functions 4 October 19th 06 04:51 PM


All times are GMT +1. The time now is 11:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"