Scroll area lock- again

K

Klemen25

Hello
I found in older posts the following code to lock the scroll area:
(I have a workbook with only one sheet: Sheet1)


Sub Workbook_Open()
Worksheets(1).ScrollArea = "A1:N50"
End Sub



This works. I save it, but after reopening it- it doesn't work. If I
go than to view code- and click run for this code- the scroll area
gets locked correctly.

My understanding is that workbook_Open should be executed as the
workbook is opened- why does it not run. Does someone have any ideas?

Thank you all!
 
S

Scoops

Hello
I found in older posts the following code to lock the scroll area:
(I have a workbook with only one sheet: Sheet1)

Sub Workbook_Open()
Worksheets(1).ScrollArea = "A1:N50"
End Sub

This works. I save it, but after reopening it- it doesn't work. If I
go than to view code- and click run for this code- the scroll area
gets locked correctly.

My understanding is that workbook_Open should be executed as the
workbook is opened- why does it not run. Does someone have any ideas?

Thank you all!

Hi Klemen

It works for me in Exel 2003 - a stupid question perhaps but you are
enabling macros when opening the workbook aren't you?

Regards

Steve
 
S

Scoops

Yes I do enable macros, and I also have excel 2003.
Any other ideas?

Only one:

Have you got the code in the "ThisWorkbook" part of the project?

Regards

Steve
 
K

Klemen25

Ha!

Great- I had it in Sheet1, and when I clicked the Thisworkbook, the
code was still on the right.
So I choose Thisworkbook and view code- and saw that the code is not
there- I copied it and it works now.

I know must get to know this vba editor, but I lack time to do it...

So thanks and all the best!
 

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