Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Zooming with the Keyboard.
by Allen Wyatt
(last updated March 31, 2018)
For most purposes, Excel allows you to issue commands and perform functions by using either the mouse or the keyboard. Unfortunately, Excel does not provide “equal access” for all commands. For instance, it is relatively easy to zoom in or out using the mouse, but there is no easy way to do it using the keyboard (other than using the keyboard to traverse the menus and select a zoom setting).
If you want the ability to zoom in or out easily using the keyboard, the only way to get it is to create a macro and then assign the macro to a keyboard combination. The following VBA macro (MyZoomIn) allows you to zoom in to (enlarge) a worksheet by 10%:
Sub MyZoomIn() Dim ZP As Integer ZP = Int(ActiveWindow.Zoom * 1.1) If ZP > 400 Then ZP = 400 ActiveWindow.Zoom = ZP End Sub
Notice that the macro only allows you to zoom in up to 400%. This is because Excel allows you to only zoom that high, and any higher would generate an error. A slight variation on the same theme results in a macro I call MyZoomOut. It zooms out of (reduces) a worksheet by 10%:
Sub MyZoomOut() Dim ZP As Integer ZP = Int(ActiveWindow.Zoom * 0.9) If ZP < 10 Then ZP = 10 ActiveWindow.Zoom = ZP End Sub
This macro sets the bottom boundary at 10%, which is the smallest you can go. Any smaller, and Excel would generate an error again.
The final trick to make these macros really useful is to assign them to a keyboard combination. You can then quickly zoom in or out by 10% with a simple keystroke. The following are the steps you can use to assign a macro to a keyboard combination:
Figure 1. The Macro Options dialog box.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12582) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Zooming with the Keyboard.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Tired of shared workbooks opening at some strange zoom factor that makes viewing your data difficult? Here's how to make ...Discover More
If you are using a mouse that has a center wheel, you can use the wheel to zoom in and out of your work. This tip shows ...Discover More
If you have trouble seeing the information presented in a worksheet, you can use Excel's zooming capabilities to ease the ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.