scroll lock

M

moiz

Hi,
I am trying to lock the scroll, My range is "a1:ar31", When i save and
close the work sheet and open again the scroll lock range dissappears. is
there any code???. please help. Thanks in advance.
moiz
 
S

Sandy

Hi Moiz

In the 'This Workbook' module :-

Sub Workbook_Open()

Sheets("YourSheetName").ScrollArea = "A1:AR31"

End Sub

Sandy
 
M

moiz

Thank u Sandy,
I copied the code and Even in properties of sheet1 scroll area i wrote the
range to lock but to my surprise when i save and exit and restart Excel the
code is there but the scrolling is not locked. where i am going wrong, please
help.
 
S

Sandy

Hi Moiz

Did you put the code in the "This Workbook" module?
If you placed it in the Sheet1 module it will not work.

Setting the ScrollArea in properties will not save.

Sandy
 
M

moiz

Thank u Sandy,
I did a mistake, thanks a lot, the code also was in sheet module as well in
workbook module. now its working fine once again thank u very much. i have
one more doubt. how to add more scrolling lock for other sheets too????
 
S

Sandy

To the code already in the 'This Workbook' module, just add the other sheets
as example below

Sub Workbook_Open()

Sheets("YourSheetName").ScrollArea = "A1:AR31"

Sheets("YourSheetNameA").ScrollArea = "A1:AR31"
Sheets("YourSheetNameB").ScrollArea = "A1:AR31"
Sheets("YourSheetNameC").ScrollArea = "A1:AR31"

End Sub

HTH
Sandy
 
M

moiz

Thanks Sandy.....Thanks once again.
moiz

Sandy said:
To the code already in the 'This Workbook' module, just add the other sheets
as example below

Sub Workbook_Open()

Sheets("YourSheetName").ScrollArea = "A1:AR31"

Sheets("YourSheetNameA").ScrollArea = "A1:AR31"
Sheets("YourSheetNameB").ScrollArea = "A1:AR31"
Sheets("YourSheetNameC").ScrollArea = "A1:AR31"

End Sub

HTH
Sandy
 
G

Gord Dibben

If you want all sheets to have the same scrollarea you can have one set of code
in Thisworkbook module.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
ActiveSheet.ScrollArea = "A1:AR31"
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top