Restricting the Scroll Area of a worksheet

It is possible to restrict the scroll area of a worksheet by using the ScrollArea property of a worksheet object.
Open the workbook and select the worksheet you want to restrict the scroll area for.
Defining a specific scrollarea though will prevent the user from being able to select the row and column headings.
Display the Control Toolbox toolbar and select the Properties button.
This will display the Properties window for that specific worksheet allowing you to define a scroll area.

microsoft excel docs

Alternatively you could use the following line of VBA code:

Sheets(1).ScrollArea = "A1:H20" 

To reset the scroll area afterwards, set the scroll area back to being the whole worksheet.

Sheets(1).ScrollArea = Sheets(1).Cells.Address 

Any cells outside this area cannot be selected.

Worksheets(1).ScrollArea = "A1:E20" 

Set this property to an empty string to enable cell selection on the entire worksheet.

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext