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: Limiting Scroll Area.

Limiting Scroll Area

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


3

When putting together a worksheet for others to use, you may want to limit the cells that the user can access. One esoteric way to add limits is to use the following steps:

  1. Right-click the sheet tab for the sheet on which you want to place a limit.
  2. In the resulting Context menu, choose View Code. The VBA editor appears, displaying the code window for the worksheet whose tab you right-clicked.
  3. If the Properties window is not visible, press F4.
  4. In the Properties Window, place the insertion point in the box to the right of the Scroll Area property. (See Figure 1.)
  5. Figure 1. The Properties window in the VBA Editor.

  6. Enter the range in which you want navigation possible. For instance, if you want the user to only be able to access the cells in the range A3:D15, then enter that range.
  7. Close the VBA Editor.

That's it; you can no longer move to or select cells outside the range you specified in step 5. The range you enter must be a contiguous range; you cannot enter a non-contiguous group of cell addresses.

You should be aware that the ScrollArea property is reset each time you restart Excel. So, if you want the scroll area to be automatically set every time you use the worksheet, you may want to set up a macro to do the modification to the property. You can do that with a simple one, like this:

Private Sub Worksheet_Activate()
     ActiveSheet.ScrollArea = "A3:D15"
End Sub 

The macro is automatically run whenever the worksheet is activated, so you are ensured that the scroll area is exactly what you want.

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 (10815) 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: Limiting Scroll Area.

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

Setting Decimal Tabs in a Table Using the Keyboard

Most people use the mouse to set tab stops in the paragraphs in a table. If you prefer to not use the mouse, then you'll ...

Discover More

Printing Show/Hide Characters

Non-printing characters are very handy to view when editing a document. But what if you want those characters to no ...

Discover More

TOC Heading Numbers Always Show in Bold

Linda's got a document that includes a table of contents that is based on headings in the document. When the headings ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Replacing Some Formulas with the Formula Results

Macros are often used to process the data stored in a worksheet. Some of these processing needs can be pretty specific to ...

Discover More

Setting Program Window Size in a Macro

The macro programming language used in Excel gives you a great many tools that allow you to modify the way that Excel ...

Discover More

Running Macros in the Background

Want to run a macro in Excel, but not sure if doing so will tie up your computer? Here's how macro processing really happens.

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 - 0?

2024-04-28 11:39:49

J. Woolley

Seb:
To limit the scroll area on a sheet:
1. Select the scroll area range on that sheet.
2. Pick Formulas > Defined Names > Define Name (Alt+M+M+D).
3. In the New Name dialog, enter
Name: ScrollArea
Scope: Workbook
Comment: Limited scroll area range
Refers to: ... (previously selected range)
4. Right-click the sheet's tab and pick View Code to open the VB Editor.
5. Copy the following code and paste it into the Sheet module (replacing the Tip's code):

Private Sub Worksheet_Activate()
Me.ScrollArea = Me.Parent.Names("ScrollArea").RefersTo
End Sub

6. Right-click the ThisWorkbook module in VB Editor and pick View Code.
7. Copy the following code and paste it into the ThisWorkbook module:

Private Sub Workbook_Open()
Range("ScrollArea").Parent.Activate
End Sub

8. Save and close your workbook.
Whenever your workbook is opened that sheet will be activated with limited scroll area. If you change the sheet's name or position, "ScrollArea" will automatically adjust. And you can edit the "Refers to:" range using the Name Manager (Alt+M+N) if necessary.


2024-04-27 17:41:10

Seb

Hi Allen,

This doesn't seem to work when opening my document, only after I navigate from that sheet and then back (perhaps with it being the first sheet of the doc?)

Sadly I am not a VBA Whizz so unsure on how to remedy this

Thanks,
Seb


2022-11-24 21:21:41

Tomek

The tip says:
"You should be aware that the ScrollArea property is reset each time you restart Excel. "

Actually, this setting will be reset if you just close and reopen the file, without closing Excel. (at least in MS365).

Also, be aware that if you set the ScrollArea many navigation shortcuts will be deactivated, e.g., End + Arrow key or Ctrl+End, if the navigation would bring you outside the ScrollArea. In other words it will not bring you to the edge of the scroll area, contrary to what you may expect.


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.