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

Inserting a Cross-Reference to the Last Style on a Page

It is often helpful to reference a specific heading in the header or footer of a page, and have that reference change on ...

Discover More

Quickly Deleting Rows and Columns

Deleting rows or columns is easy when you use the shortcut described in this tip. Just select the rows or columns and ...

Discover More

Including Footnotes and Endnotes in Word Counts

When you have Word calculate how many words there are in a document, it normally doesn't pay attention to text in ...

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 (ribbon)

Pausing Macros for User Input

Does your macro need to get some input from a user? Here are the ways that Excel provides for that input to be solicited.

Discover More

Using Macros in Protected Workbooks

Having problems with using macros in a protected workbook? There could be any number of causes (and solutions) as ...

Discover More

Importing Based on a Partial File Name

A common task for macros is to open and process a file you want imported into your workbook. If you need to identify 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}] (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 two more than 7?

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.