Editing a Chart on a protected worksheet

O

OMER

Hola,
I wonder if there is a way to allow the user to edit an embedded chart
within a protected worksheet. I know that setting the parameter
DrawingObjects=True (when protecting the worksheet) allows for editing while
protected. However, in the worksheet there are other shapes that I don't want
the user to be able to edit.
Is there a way accomplish this using VBA code?
Thank you in advance for your reponse.
OMER
 
P

Peter T

With the sheet unprotected...
Select the chart as a chartobject (hold ctrl and select)
Right click, Protection, untick Locked
Protect the sheet

Regards,
Peter T
 
O

OMER

Thank You so much Peter.

I was not familiar with the object approach outside VBA.
For some reason I couldn't select the object as you instructed. However, I
used the Find&Select option on the Ribbon to select the chart and then I
could follow your instructions.

Thanks again.
OMER
 
P

Peter T

You could of course do same with VBA. Normally I'd suggest record a macro
but as the macro recorder doesn't work fully with shapes and charts, try
something like this

Sub test()
Dim sPW As String
Dim ws As Worksheet

sPW = "abc"
Set ws = ActiveSheet

ws.Unprotect Password:=sPW

ws.Shapes("Chart 1").Locked = False

ws.Protect Password:=sPW, _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True
End Sub

Regards,
Peter T
 

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