Worksheet activate not happening when workbook first opens

ElvisSteel

Board Regular
Joined
Mar 23, 2009
Messages
122
Hi,

I have a workbook where the sheets are all protected and I want to stop users scrolling up or across beyond the limits of the input areas.
I have used the following code (or variations of)...

Private Sub Worksheet_Activate()
Me.ScrollArea = "A1:G32"
End Sub

This works fine except that when I first open the workbook, the first sheet displayed can still be scrolled. As soon as you move to another sheet and then back again, it is then OK.

It appears that the Worksheet_Activate code does not execute when the workbook is first opened.

How do I get round this?

Thanks
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
you need to put it in the workbook events - specifically Workbook_Open(). thks

Kaps
 
Upvote 0
Have you tried using the Workbook_Open event procedure? Example:

Code:
Private Sub Workbook_Open()
    Worksheets("Sheet1").ScrollArea = "A1:G32"
End Sub
 
Upvote 0
What code do I need in the Workbook_Open event in order to achieve the same as "Me.ScrollArea" within the workbook code?
 
Upvote 0
Try

Code:
Private Sub Workbook_Open()
    ActiveSheet.ScrollArea = "A1:G32"
End Sub
 
Upvote 0
Andrew,

Sorry cheating by using this thread for a separate question but could you use your expertise to look at another thread of mine that has had no response...

If you search for my posts "ElvisSteel", it is the one entitled "Ctrl Page Down in Protected sheet"

Thanks
 
Upvote 0
If the scroll area is the same each time, why don't you just set it and then save the workbook?
 
Upvote 0
If the scroll area is the same each time, why don't you just set it and then save the workbook?

I just confirmed this to be sure...

The Scroll Area setting is NOT saved when the book is reopened.

At least in XL2003 it is not.
 
Upvote 0

Forum statistics

Threads
1,215,331
Messages
6,124,311
Members
449,152
Latest member
PressEscape

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