Protection of shapes on sheet

shawleigh17

Board Regular
Joined
Nov 16, 2007
Messages
79
Hi, I added the following code to my vba code for the workbook_open module. This code was generated using a macro recorder, but now it doesn't seem to work when I move the code to the open event.

Code:
Sheets("Layout_Manager").Select
    Sheets("Layout_Manager").Protection.AllowEditRanges.Add Title:="Layout_Manager_Edit", Range:= _
        Range("B4:BC100"), Password:="xxxxxxxx"
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

I get an application error. Any suggestions.
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hmmm... if you're using the Workbook_open event, try this:

Code:
Private Sub workbook_open()
Application.Goto "LayoutManager"
'the rest of your code here
End Sub

Select a cell - maybe A1 - in your worksheet named Layout Manager, and name it LayoutManager or something else you might like. You won't need to select the sheet, and you won't get the Application Error.

This should solve your problem. And, remember to put the code in the ThisWorkbook module.

Regards,
XLXRider
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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