Protect all objects except comments

taco truck

New Member
Joined
Mar 31, 2009
Messages
3
Hi all,

I am new to the forum. My question is if I am designing a workbook for users, how do I allow a user to edit and insert comments but protect all other objects in a sheet (e.g. buttons, company logos that are images, etc.)? I know it is possible to uncheck a box in the protection settings that allows one to protect a sheet without protecting the objects. I also know that one can unlock an object so that when the sheet is protected (including objects) the object can still be edited. Again, my question is how do I allow a user to edit and insert comments but protect all other objects in a sheet (e.g. buttons, company logos that are images, etc.)?

Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I have left some cells unlocked for the user to edit the contents. The user should also be allowed to insert and edit comments in the unlocked cells.

The protection settings are set to allow the user to select any cells, format cells, format rows, and format columns.

Again, I dont want to allow the user to edit objects, because there are objects other than comments that I don't want to be edited.

Thanks for you help.

Cheers,
TT
 
Upvote 0
Assign this macro to all of the shapes on the sheet.
Code:
Sub AllShapeCode()
    With ActiveSheet
        If .ProtectContents Then
            .Unprotect
            .Protect DrawingObjects:=True, contents:=True, Scenarios:=True, userinterfaceonly:=True
        End If
    End With
End Sub
and put this in the sheet's code module
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    With ActiveSheet
        If .ProtectContents Then
            .Unprotect
            .Protect DrawingObjects:=False, contents:=True, Scenarios:=True, userinterfaceonly:=True
        End If
    End With
End Sub
When the sheet is protected, the user will be able to edit any cell's comments, but cannot alter any shape or object that calls that macro.
 
Upvote 0
OOOH! Very clever solution! Thank you! This works for almost all cases. I can still right click on the object in some cases and make edits. Any workarounds?

Thanks Again!
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,431
Members
448,961
Latest member
nzskater

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