Scroll Area Not Working

Helix242

Board Regular
Joined
Jun 28, 2016
Messages
78
Hi,

I am trying to activate a scroll area, but it just isn't working. The names are exactly the same. I have 2 sheets, the second one is called CONTACT and this is the one I am trying to lock. Although when I use this code it just doesn't lock. Any help would be appreciated.

Many thanks

Private Sub Workbook_Open()
Worksheets("CONTACT").ScrollArea = "A1:G1000"
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Welcome to the forum.

Is that code in the ThisWorkbook module of your workbook?

Also, do you mean you can still scroll column A off screen after running that code yourself?
 
Upvote 0
Hi Rory,

Thank you.

A bit of a novice here, so I'll try to answer as best I can! I have several spreadsheets open and I just want to lock the scroll area in this one. The code is in the (VBA) View Code section of the Developer Tab, for this spreadsheet. I want to lock any cells beyond column G and Row 1000. I can still select the cells after I enter this code. The only way I can lock it is to manually enter the A1:G1000 in the Scroll Area section, but have to do that every time I open the sheet. So the code just isn't locking any area. I am unsure if I have to have a certain setting activated??
 
Upvote 0
That code must go into the ThisWorkbook module of the workbook in question or it won't run when the workbook opens.
 
Upvote 0
Hi Rory,

Thank you for the information, but I am a bit unsure what you mean. Where do I access ThisWorkbook module in the View Code section? Sorry for being stupid!
 
Upvote 0
You should see the Project Explorer window in the top left of your VB Editor, which shows you the open workbooks and all their components. You need to double click on the ThisWorkbook object for the relevant workbook.

<img src="https://ruirlw.dm2302.livefilestore.com/y3mF8uQGIgIQiKk74fFtn0t5kTDldhZWtxcS7Imjoapy3_pogLcztvP-htyNF88-_pWG55tqGH8XY9QDiQKN3aBDy0OOs6sPRHdXMnSe2nabQzBNXgrlOVuVe3dF6dsBXCiCOAn61u85D3SKQ55TMzlzjDS29Hx6FmJiXnXDguMZrU?width=330&height=361&cropmode=none" width="330" height="361" />

Edit: aha - you beat me to it. Good work! :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,603
Members
449,089
Latest member
Motoracer88

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