Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Zooming With the Keyboard.

Zooming with the Keyboard

by Allen Wyatt
(last updated June 29, 2013)

4

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) allow 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:

  1. Press Alt+F8. Excel displays the Macro dialog box, which includes a list of your defined macros. (MyZoomIn and MyZoomOut should be among them.)
  2. Select the MyZoomIn macro.
  3. Click on Options. Excel displays the Macro Options dialog box. (See Figure 1.)
  4. Figure 1. The Macro Options dialog box.

  5. In the Shortcut box, specify the shortcut you want to use. For instance, if you want to use Ctrl+I, you would enter an I in the Shortcut box.
  6. Click on OK.
  7. Select the MyZoomOut macro.
  8. Click on Options. Excel again displays the Macro Options dialog box.
  9. In the Shortcut box, specify the shortcut you want to use. For instance, if you want to use Ctrl+O, you would enter an O in the Shortcut box.
  10. Click on OK.
  11. Click on Cancel to close the Macro dialog box.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2731) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Zooming With the Keyboard.

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

Snapshots of Excel Worksheets for PowerPoint

If you need to get lots of information from Excel to PowerPoint, the task can be daunting. This tip explains different ...

Discover More

Making Banners in Word

Word can be used for printing a variety of document types. You may want to use the program to print a festive banner for a ...

Discover More

Finding Text in Text Boxes

Want to search for text that may appear in a text box rather than in a regular worksheet cell? You can only perform the ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (menu)

Selecting Noncontiguous Ranges with the Keyboard

It's easy to select non-contiguous ranges using the mouse, but may seem more daunting if you are simply using the keyboard. ...

Discover More

Turning Off Dynamic Menus

You may want to adjust the way that Excel displays its various menus. This tip explains how you can turn off the dynamic menu ...

Discover More

Changing Excel's Starting Date

When keeping track of dates, internally, Excel uses special date serial numbers that are based upon a specific day in the ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. 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 7 - 0?

2014-09-17 21:05:21

ivana

It actually does: just hold Ctrl and scroll with two fingers across touchpad.


2014-08-22 10:24:58

Willy Vanhaelen

Willy Vanhaelen 06 Apr 2013, 06:55
Here is a one line variant of both macros:

Sub MyZoomIn()
ActiveWindow.Zoom = Application.Min(Int(ActiveWindow.Zoom * 1.1), 400)
End Sub

Sub MyZoomOut()
ActiveWindow.Zoom = Application.Max(Int(ActiveWindow.Zoom * 0.9), 10)
End Sub


2014-08-22 07:48:10

Abhishek Tharval

It will be great if I get code for excel short cuts on my email address.


2014-08-21 07:38:54

JessD

Thanks for this! Strange Excel wouldn't have a built-in shortcut for this like Ctrl-+.

An additional tip is that you can put this in a homemade add-in by saving as an XLAM, putting it in AppData/Roaming/Microsoft/AddIns. Then you can add the add-in in Excel and it will be available all the time.

Also, if you already have such an add-in that you want to add these zooming macros to, when you hit Alt+F8, you have to type in "MyZoomIn" for the macro name so that you can assign a shortcut key to it.

Last thing: I changed it to ".Zoom + 10" since the multiplication meant it would go to 110, then 121, etc, and you couldn't get back to 100 easily.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.