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
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.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Today's PCs are more powerful than ever, but you can still have slowdowns when it comes to calculating large workbooks. ...
Discover MoreIf your arrow keys and the Enter key aren't working as you expect them to, the problem could have any number of causes. ...
Discover MoreAs the limits on what you can store in Excel have increased, so has the need to consider how to make your workbooks and ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments