Prevent Scrolling on Excel Worksheet

Prevent Scrolling on Excel Worksheet

HomeOther ContentPrevent Scrolling on Excel Worksheet
ChannelPublish DateThumbnail & View CountActions
Channel Avatar Contextures Inc.2013-10-01 20:30:32 Thumbnail
44,762 Views
http://www.contextures.com/excelworksheettips.html Visit this page for written instructions, and to download the sample file.

Even if a worksheet is protected, you can scroll in any direction, and see what is on the sheet. To help prevent scrolling, you can change the ScrollArea property for the worksheet, either manually or with a macro.

The Scroll Area setting is handy as a navigation aid, and it can deter people from clicking or scrolling through the worksheet. However, it can be easily removed, so do not depend on it to add security to your file.

NOTE: The Scroll Area has to be set each time the workbook opens. To automate this, use a macro, as shown below.

To manually set the Scroll Area:

On the Ribbon, click the Developer tab, and click Properties

In the Properties window, enter a range address in the ScrollArea property box

Click on the worksheet, and you will be restricted to clicking and scrolling in the Scroll Area.

To manually clear the Scroll Area:

On the Ribbon, click the Developer tab, and click Properties
In the Properties window, delete the address in the ScrollArea property box
Click on the worksheet, and you will be restricted to clicking and scrolling in the Scroll Area.

The Scroll Area setting has to be set each time the workbook opens, and you can automate that with a macro. Copy the SetAllScrollAreas macro to a regular module in your workbook. It will set the Scroll area for each worksheet in the file, based on the Used Range on that sheet.

Sub SetAllScrollAreas()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.ScrollArea = ws.UsedRange.Address
Next ws
End Sub

Then, add the SetAllScrollAreas macro name to the Worksheet_Open procedure in the ThisWorkbook module. This will set the scroll areas on all sheets, each time that the workbook is opened and macros are enabled.

Private Sub Workbook_Open()
SetAllScrollAreas
End Sub

Please take the opportunity to connect and share this video with your friends and family if you find it useful.