
Tips.Net > ExcelTips Home > Formatting > Random Width and Height Changes
Summary: Does your workbook exhibit seemingly random changes to column width and row height? The answer could be simple or not so simple, but you can overcome any unwanted changes by a simple macro-based solution. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)
Gary has a workbook set up with twelve worksheets, one for every month. He has framed the information in these worksheets so it just fits on his screen. At some point he opens his workbook to find that the January column widths have expanded so that they don't all fit on my screen. It is only the January columns that expand, but all worksheets will have their row heights expand from 12.75 to 13.50. If Gary resizes everything back so it once more fits his screen, everything is fine for a week or so, and then the resizing happens again.
It is unclear what might be causing this problem, but there are a few things you can check. If the workbook is stored on a network, where it can be accessed by other people, it could be that the change is occurring while someone else has the workbook open. In addition, if the workbook is opened on different machines, it could be that the other machines on which it is opened may be affecting the workbook, provided they have different screen resolutions or different printer fonts installed.
Being unsure as to the cause, it may be that the best solution is to create a macro that runs automatically when the workbook opens. This macro could go through the worksheets and set the column widths and row heights to what you need The following macro will perform these steps:
Private Sub Workbook_Open()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
' Change to the columns you need
Columns("A:M").Select
' Change to the width you need
Selection.ColumnWidth = 12
' Change to the rows you need
Rows("1:15").Select
' Change to the height you need
Selection.RowHeight = 13
Next wSheet
End Sub
Tip #3175 applies to Microsoft Excel versions: 97 2000 2002 2003 2007
PivotTables Got You Perplexed? PivotTables for the Faint of Heart shows how you can start using Excel's PivotTable tool right away to spin your data into gold! You discover how easy it really is to crunch the numbers you need to crunch. Uncover the power of creating PivotTables, editing them, formatting them, customizing them, and much more.
Check out PivotTables for the Faint of Heart today!
If you have tons of data to analyze, one of the best tools in Excel's arsenal is the PivotTable. Learn how to use this tool to analyze your data. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Bugs and Pests Tips
ExcelTips
Family Tips
Health Tips
Home Tips
Organizing Tips
WordTips
Advertise on the
ExcelTips Site