Solved

MS Excel preserving column widths upon data refresh

Posted on 2014-01-03
3
498 Views
Last Modified: 2014-01-03
The workbook connection properties, usage, refresh control are set to Enable background refresh and refresh data when opening the file.

The worksheet is formatted to fit on a single page when printed. However whenever the data is refreshed I lose my desired column widths.

How can I preserve column widths upon data refresh?
0
Comment
Question by:Lee Ingalls
3 Comments
 
LVL 10

Expert Comment

by:etech0
ID: 39753996
Try this:

in excel, press Alt-F11. This will open the VB editor. On the left side, double click on Sheet1 (or the name of your sheet in question)

Paste this code into the white code editor:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Columns.AutoFit
End Sub

Open in new window


It will do Autofit again every time things change.
0
 
LVL 23

Accepted Solution

by:
NBVC earned 500 total points
ID: 39754000
If you go to Data tab, then Properties (from the Connections section).  There will be a checkbox called Adjust Column Width.  Make sure it is not checked.
0
 
LVL 7

Author Closing Comment

by:Lee Ingalls
ID: 39754016
Ok, I feel foolish for that one. Thanks NBVC!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now