ScrollArea Property

confusion123

Active Member
Joined
Jul 27, 2014
Messages
400
Has anyone used the ScrollArea property extensively to limit access to a worksheet?

From my limited use, it seems to be flaky, ie if I set it to C:F and say column A is hidden, I have found I cannot unhide it.
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I've found, you need to set the ScrollArea = "" before hiding/unhiding rows or columns. Once changes are complete, restore the ScrollArea. If you wrap your code in Application.ScreenUpdating = False / True, you get a smoother effect.
 
Upvote 0
For some reason, if I set the scrollarea property to say B:R, when I save, close then re-open the workbook, the scrollarea property is cleared, meaning I can get to column A, when I don't want to.
 
Upvote 0
Do you have any WorkBook Save events (etc...)? Are there any other subs that would change your scroll area? Would you be able to post some code segments?
 
Upvote 0
No, there's no code at all, as I've saved the workbook as .xlsx.

I hide column A, then manually go to Sheet1 in the VB Editor, press F4 to bring up the properties window, then set the ScrollArea to B:R.

Save the workbook, exit then open again and the Scrollarea property is empty.

Try it for yourself, I'm using Excel 2013.

To overcome this, I actively created a Worksheet_Activate event with the code below:

Code:
Option Explicit

Private Sub Worksheet_Activate()

    Me.ScrollArea = "B:RS"
    
End Sub
 
Last edited:
Upvote 0
The scroll area does not persist when excel closes. In order to have the scroll area locked, you'd need to add code.

example:
Code:
Private Sub Workbook_Open()
Sheets(1).ScrollArea = "$B:$R"
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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