Making Pane Settings Persist

Written by Allen Wyatt (last updated January 5, 2021)
This tip applies to Excel 2007, 2010, 2013, and 2016


If Cindy freezes panes in a worksheet and then saves the workbook, the next time she opens that workbook the previously frozen panes no longer appear. Each time she opens the workbook, she needs to reset the panes. Cindy doesn't think it used to be this way in older versions of Excel and wonders if there is some setting she needs to make or wonders, perhaps, if Excel has changed how it handles panes. She wants to save the pane settings with the workbook so they persist from one usage to another.

The default behavior of the latest versions of Excel is that your pane settings should be persistent, just as Cindy remembers in older versions of Excel. If that is apparently not happening for you, there are a few things you can check:

  • See if someone else is updating or using the workbook and, while doing so, removing the panes.
  • Check to see if the workbook has a macro that runs automatically when starting that removes the panes. You might try looking for the text "FreezePanes" in the macros.)
  • See if the workbook is actually being saved in a non-Excel format, such as CSV or HTML. Other formats don't necessarily hold on to some settings, such as panes. (Save the file in XLS or XLSM format to see if that fixes the problem.)
  • Is the workbook, when open, being worked with using multiple windows? If so, and one of the windows doesn't use panes, the settings in the last-closed window are those that will "stick" in the workbook.
  • Check if the workbook is being shared with others. Some users report an oddity where pane settings may not save properly in shared workbooks.
  • Are filters being used in the workbook? If you apply filters, then set panes, and finally remove filters, the panes may also go away.

If none of those ring a bell with you, try starting with a brand new, blank workbook. Put some test data in it, freeze the panes, and then save it. Exit Excel and open the workbook again. If the panes are still there, then this is a good sign that the problem is with the other workbook only. In that case, it could be that the workbook is becoming corrupted (for some reason) and you may need to work on getting your data into a different workbook.

There are two other things you can do, if you desire. One is to simply save a custom view of your worksheet, with the panes in place. You should then be able to load the custom view at a later time and have the pane settings be present (along with many other settings) so that you can continue working with the workbook.

The other thing you could try is to create your own macro that sets the panes as you want them to appear. Here's an example:

Private Sub Workbook_Open()
    ActiveWindow.FreezePanes = True
End Sub

This macro would be added to the ThisWorkbook module, and you'll need to change the cell reference (D4) and worksheet name (Sheet1) to reflect where you want the panes set. You could also, if desired, change the code to a "regular" macro that could be assigned to a shortcut key or the Quick Access Toolbar. That way you could use the macro to set similar panes in any worksheet, with the click of a button.

Sub SetPanes()
    ActiveWindow.FreezePanes = True
End Sub

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (604) applies to Microsoft Excel 2007, 2010, 2013, and 2016.

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. ...


Using Very Large Font Sizes

You can format your text to use some very, very large font sizes. The results you see from formatting with large fonts ...

Discover More

Adding Phrases to the Grammar Checker

Word's grammar checker dutifully tries to mark all the questionable grammar in your sentences. If you are tired of a ...

Discover More

What is a Desktop.ini File?

When browsing through your system, you might see several files named Desktop.ini. This tip explains what these files are ...

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)

Can't Access the Registry

Many Windows applications rely on information stored in the Registry. If that information cannot be accessed, the ...

Discover More

Message about a Problem with the Clipboard

Imagine this: You are working along just fine in Excel, then you try to make an edit to your workbook that causes a ...

Discover More

Weird Actions for Arrow Keys and Enter

If your arrow keys and the Enter key aren't working as you expect them to, the problem could have any number of causes. ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


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

2021-01-05 10:38:24

David Bonin

Here's something that may be helpful if Cindy's problem is caused by multiple people using the same workbook.

If Cindy creates a Private Sub Workbook_Open() macro that changes the workbook appearance every time the workbook is opened, she may inadvertently start an office war over the "proper" appearance of the workbook. This is even more likely if Cindy is not the main user.

How to fix this?

Simply include a test in the Workbook_Open() macro to determine whether Cindy is opening the workbook.

If it is Cindy, go ahead and do Cindy's formatting.

If not Cindy, then quit the macro.

The test looks something like:
   If Application.UserName <> "Cindy") Then Exit Sub

Replace "Cindy" with her actual User Name in Microsoft Office.

Instead of Exit Sub, the macro could take some other action. For example, if Cindy's workbook nemesis is someone higher up, Cindy could write the macro to provide that user with the specific layout they want. Result: everyone gets what they want and Cindy's boss is happy.

2017-04-23 15:58:23


I don't know of a way to freeze panes on a worksheet without selecting (activating) first. After all, FreezePanes is purely visual so there would be no reason to freeze the panes until it is to be viewed. Your comment about selecting Range("A1") is a good one, except you should select Range("A1") AFTER selecting (and freezing the panes) Range("D4") if you want the cursor to end up on A1. With your code, the cursor ends up on the last selected cell - D4 - and you'll still see the first 4 rows and columns in the active window.

Also note that Allen's code above in the Workbook_Open module --

ActiveWindow.FreezePanes = True

will only work if the workbook opens on Sheet1. As you know the workbook will open to whatever worksheet had the active window when last saved. So, if you were on Sheet2, saved and closed the file, then reopened it you would get a range select error code '1004'. You would need to separate the worksheet select and range select into two separate actions.


If you want to freeze the panes of a worksheet during the Workbook_Open event without ending up on that worksheet, the following code will work. Basically, it sets the active worksheet during open to a variable (OpenSht), selects and freezes the panes for the desired worksheet (in this case Sheet2), then activates the original active worksheet. We use the Application.ScreenUpdating = False to perform this in the background.

Private Sub Workbook_Open()
Dim OpenSht As Worksheet

Application.ScreenUpdating = False

Set OpenSht = ActiveSheet

ActiveWindow.FreezePanes = True


Application.ScreenUpdating = True
End Sub

Hope this helps.

2017-04-23 03:58:39

Christian Sommerhuber

I have a small comment on your solution: It may happen that the window is scrolled and - in your example - the row 4 and/or the column D is the first one currently displayed. If the real intent is to always show the first 4 rows and columns you should add an extra statement as shown below:

Sub SetPanes()
ActiveSheet.Range("A1").Select ' make sure the top cell is displayed
ActiveWindow.FreezePanes = True
End Sub

By the way: is there an alternative of setting the freeze zone without activating the sheet?

Best regards,

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

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.