PDA

View Full Version : Restrict Worksheet Scrolling Help



gimli
04-06-2010, 08:13 AM
Hi,

I am using the following code to limit scrolling for a specific worksheet.


Option Explicit
Private Sub Worksheet_Activate()
Sheet1.ScrollArea = "b1:q27"
End Sub


This code is entered via the worksheet tab. It works fine if I run it manually....shouldnt this run automatically when the workbook is opened since its coded on the worksheet?

any suggestions?

thanks much

lucas
04-06-2010, 08:28 AM
It will only work when the worksheet is activated.

try selecting another worksheet and then select the one with the code.

gimli
04-06-2010, 08:43 AM
ah..your right. I selected another worksheet..then selected the worksheet with the code and it worked.

anyway to code it so it works when the workbook is opened? That will be the main work sheet...no other tabs will be visable to the user.

thanks much

lucas
04-06-2010, 09:07 AM
Put this in the thisworkbook module of the workbook. Close it and re-open it:


Private Sub Workbook_Open()
Sheet1.ScrollArea = "b1:q27"
End Sub

gimli
04-06-2010, 09:50 AM
Perfect! works just fine :thumb