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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,217,681
Messages
6,137,957
Members
450,101
Latest member
Mrupe86

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
Back
Top