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

Positioning a Column on the Screen

Written by Allen Wyatt (last updated December 21, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


Riek encountered a problem while developing a macro that sets up the screen for user input. Columns A:G always need to stay on the screen, so his macro freezes those columns. He then issues a command to move to column Z to start input. This places columns T:Z to the right of the frozen columns A:G. What Riek really wants is for columns Z:AF to appear to the right of A:G, but he doesn't know how to accomplish that.

There are several ways that the desired results can be achieved. The first is to simply move "past" the desired target, and then move back to it, as in the following macro:

Sub GotoCol1()
    With Application
        ActiveWindow.FreezePanes = False
        Range("H1").Select
        ActiveWindow.FreezePanes = True
        .Goto Range("IV1")
        .Goto Range("Z1")
    End With
End Sub

The important code lines are those that use the Goto method. The first jump is to the last cell of the first row, and the second jump moves back to the true target, Z1. By moving in this way, column Z ends up just to the right of the frozen range, A:G.

While this works just fine, a better solution would be to use the Scroll parameter with the Goto method. Consider the following example:

Sub GotoCol2()
    ActiveWindow.FreezePanes = False
    Range("H1").Select
    ActiveWindow.FreezePanes = True
    Application.Goto Reference:=Range("Z1"), Scroll:=True
End Sub

The Scroll parameter is optional with the Goto method; it defaults to False. If you set it to True, then Goto scrolls through the window so that the upper-left corner of the target range (Z1) appears in the upper-left corner of the window.

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 (10523) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Positioning a Column on the Screen.

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

Converting Numbers to Text

Got some numbers you need spelled out? Here's a handy macro that can convert numbers like "123" to words like "one ...

Discover More

Understanding Document Variables

When working with macros, you may want to create a variable that will remain constant from one instance of the macro to ...

Discover More

Word Graphics (Special Offer)

One way to enhance your documents is with Word's powerful graphics capabilities. Another way is by harnessing the macro ...

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)

Finding Positions of Formatted Characters in a Cell

With a little bit of work, Excel allows you to format individual characters of the text you place in a cell. If you want ...

Discover More

Cropping Graphics in a Macro

Excel allows you to easily paste graphics into a worksheet. Once added, you may want to quickly process the graphics by ...

Discover More

Self-Deleting Macros

Macros are very powerful, but you may not want them to always be available to a user. Here are some ways you can limit ...

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 6 + 5?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.