How do I stop a user scrolling across?

69liz

Board Regular
Joined
May 28, 2004
Messages
78
Hi!

How do I restrict the visible area of a spreadsheet? I have a spreadsheet and I don;t want the user to be able to scroll across into the other columns or down to the other rows? Can I do this?

Thanks

Liz
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
You can do this with a macro - if you change its name to Auto_Open it will run automatically when the workbook is opened. It will only prevent scrolling, not viewing.

Code:
Sub RestrictScrollArea()
    With ThisWorkbook.Worksheets("Sheet1")
        .ScrollArea = "A1:D4"
    End With
End Sub

Change range to suit.
 

DominicB

Well-known Member
Joined
Oct 3, 2005
Messages
1,569
Good evening 69liz

Something like this :

Code:
Private Sub Workbook_Open()
Sheets("Sheet1").ScrollArea = ("A1:H10")
End Sub

The above code will restrict the user to the range A1:H10. Unfortunately this setting isn't saved with the file so this code would need running every time the file is opened - hence the Workbook_Open routine. It needs copying into the ThisWorkbook module of the VBE.

HTH

DominicB
 

Forum statistics

Threads
1,136,517
Messages
5,676,314
Members
419,619
Latest member
jalme

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top