Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. 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: Displaying a Set Column Range.

Displaying a Set Column Range

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


2

Let's say that you want to display a specific number of columns on a worksheet in the available window space. You can manually figure out the necessary width of each column and do the adjustments, or you can write a macro that will figure out, proportionally, how the width of each column should be adjusted to get the desired results.

An easier method, however, is to just adjust the zoom factor for a desired number of columns. This can be done manually by selecting the columns, displaying the View tab of the ribbon, and clicking the Zoom to Selection tool in the Zoom group.

If you want to do it programmatically, it is even easier. Right-click a worksheet tab (the one you want this macro to apply to) and then choose View Code from the resulting Context menu. Excel displays the Visual Basic Editor, and you should enter the following into the code window:

Private Sub Worksheet_Activate()
    Range("A1:L1").Select
    ActiveWindow.Zoom = True
    Range("A1").Select
End Sub

This particular macro assumes that you want to view columns A through L in the window. It selects the range A1:L1, and then sets the zooming factor to display just that selection (the columns you want). Finally, it selects cell A1 and ends.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7805) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Displaying a Set Column Range.

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

Understanding Page Border Art

Add some artwork around the border of your printed page, and you may not know where that artwork comes from. You may also ...

Discover More

Closing Up Cut Rows

When you cut and paste rows using Ctrl+X and Ctrl+V, Excel leaves empty the rows where the cut information was previously ...

Discover More

Ignoring N/A Values in a Sum

You can use some of Excel's worksheet functions across a range or worksheets, but not all of them. One that has problems ...

Discover More

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!

More ExcelTips (ribbon)

Always Open at 100% Zoom

Tired of shared workbooks opening at some strange zoom factor that makes viewing your data difficult? Here's how to make ...

Discover More

Nifty Zooming

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

Zooming With the Keyboard

Excel doesn't provide a keyboard shortcut that allows you to zoom in or out on your workbook. It is easy, however, to ...

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 2 + 2?

2024-01-26 18:38:49

J. Woolley

Re. my previous comment below, I should have mentioned the AdjustRowHeights macro to adjust the height of selected rows with the same features as AdjustColumnWidths.
See https://sites.google.com/view/MyExcelToolbox/


2024-01-26 10:45:35

J. Woolley

My Excel Toolbox includes the AdjustColumnWidths macro to adjust the width of selected columns by a fixed increment or a proportional multiplier. Either choice includes an option to span the active window without changing the zoom factor. This macro supports Undo (Ctrl+Z).
See https://sites.google.com/view/MyExcelToolbox/


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.