Setting a Default Workbook Window Size and Zoom Level

Written by Allen Wyatt (last updated February 17, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


6

Mike creates new workbooks all the time, and tends to use them in quite large windows. Recently, every workbook he opens does so in a small window, meaning he has to resize it and increase the zoom. This becomes aggravating when he creates his tenth new workbook of the day. Mike wonders if there is a way to specify the size of a new workbook window and the zoom level?

There are two ways you can approach this when dealing with new workbooks. First, an easy non-macro way is to create a new workbook and size and zoom it as you'd like. Then, save the workbook either as a normal workbook or as a template. You can then use this workbook or template as the basis for any new workbooks you want to create. They will already be sized and zoomed as you desire, and they can even contain other "boilerplate info" that you may want to use in your workbooks.

The other approach is to use a macro to create the workbook for you. It doesn't have to be anything complex:

Sub CNWkBk1()
    Workbooks.Add
    Application.WindowState = xlMaximized
    With ActiveWindow
        .WindowState = xlMaximized
        .Zoom = 150
    End With
End Sub

This macro creates a new workbook, maximizes the window, and then sets the zoom level to 150. If you would rather have the workbook be a different size (non-maximized), you could modify the macro a bit:

Sub CNWkBk2()
    Const PtPerPx As Single = 72 / 96

    Workbooks.Add
    With ActiveWindow
        .WindowState = xlNormal
        .Zoom = 150
        .Left = PtPerPx * 450
        .Top = PtPerPx * 0
        .Width = PtPerPx * 1200
        .Height = PtPerPx * 1040
    End With
End Sub

This macro sets the window to a normal state, which means it doesn't take the whole screen and can, therefore, be sized. It then sets the window with its top-left corner at (450,0) pixels and its bottom-right corner at (1650,1040). Any of these values can be modified to fit your own needs.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (5223) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Selecting Text Orientation for an Axis in Microsoft Graph

Microsoft Graph allows you to easily create charts from numeric data, without the need to use Excel. This tip explains ...

Discover More

Quickly Changing Font Sizes

A quick little shortcut can help you easily step through different font sizes for whatever text you've selected. Word ...

Discover More

Put Your Space Before or After?

When working with spacing between paragraphs, Word allows you to specify exactly how much space should be either before ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Losing Data in a Shared Workbook

When you create a shared workbook, you run the risk of losing some of the data in that workbook. Here's a discussion ...

Discover More

Can't Access the Registry

Many Windows applications rely on information stored in the Registry. If that information cannot be accessed, the ...

Discover More

Saving Movement on Enter with a Workbook

Press Enter when working in a workbook and Excel moves to a cell adjacent to the one in which you were working. If you ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 5?

2024-02-26 07:45:39

Hans Hallebeek

I get very upset by the way others set up their workbooks.
To avoid these annoyances I have set my default excel settings in my personal macro book, in a sheet I set my default settings:
Formula visibility
Grid visibility
Application window size
Zoom
Etc
These settings are executed when the personal macro book is opened and in the workbook before close event
When another workbook has other settings these will temporarily apply until it’s closed


2024-02-22 17:53:54

Tomek

Further to my earlier comments, it is likely Windows that remembers sizes of various program windows, not specifically Excel.
The end result is the same though.


2024-02-19 15:57:42

J. Woolley

To specify the position and size of each workbook when it is opened, including a new workbook, put this code in the ThisWorkbook module of Personal.xlsb or an Excel add-in file (.xlam). If the workbook's window is Normal (not Maximum or Minimum), this code positions its top-left corner at (450,0) pixels and its bottom-right corner at (1650,1040) pixels; adjust those values as required.
This code runs automatically; it is not a macro requiring manual activation.

Private WithEvents App As Application 'locate before procedures

Private Sub Workbook_Open()
Set App = Application
End Sub

Private Sub App_NewWorkbook(ByVal Wb As Workbook)
App_WorkbookOpen Wb
End Sub

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
Const PtPerPx As Single = 72 / 96 'points/pixel
With Application
If .WindowState = xlNormal Then
.Left = PtPerPx * 450
.Top = PtPerPx * 0
.Width = PtPerPx * 1200
.Height = PtPerPx * 1040
End If
End With
End Sub

Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
With Application
If .Workbooks.Count = 1 Then 'last workbook closed
.Visible = False
.Quit
End If
End With
End Sub

See https://sites.google.com/view/MyExcelToolbox


2024-02-18 15:24:14

Tomek

What I said in my earlier comment applies to the window position too.


2024-02-18 15:22:29

Tomek

Excel seems to remember the size of its window when you last closed it. Any next session will automatically start with this size of the window, whether you just start a new session with the default blank workbook, use a template or open an existing file. This size can be probably modified by a Before_Close macro.

There is an exception to that if you use a shortcut somewhere (Desktop, in the file explorer, in the start menu, on the taskbar, etc), in which it is specified to run the program in a maximized window. In such case the program will always open with the window maximized.
Also, if the last session you closed was in maximized window, and the shortcut specifies normal window, it will still open in maximized window as this is the last remembered one and it becomes a new normal.

The shortcut can point to the Excel program itself, or to any Excel files or templates. It could also point to another shortcut, but I did not check setting of which takes precedence.


2024-02-17 11:21:54

Brian Lair

This is one of the very few things that aggravate me about Excel — its seemingly random sizing and placement of windows when creating or opening workbooks. Long ago, I created a macro similar to your CNWkBk2 and put a button for it on the Quick Access bar. I’ve just gotten into the habit of clicking that button every time.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.