Problem with using an image to fire a macro from a protected chart sheet

oCoCarbon

New Member
Joined
Oct 11, 2010
Messages
29
I have a chart sheet which contains an image assigned to a macro. The macro should take the user to a data entry sheet where they can edit the data for the chart.

This works just fine when the sheet is unprotected, but when it is protected it won't let me click on the image. Is there any way of selectively protecting a chart sheet so the macro control image stays active?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
You could unlock the sheet when the code initializes using :
Code:
Worksheets("Sheet1").Unprotect password:="Password"
Then lock it after your code runs:
Code:
Worksheets("Sheet1").Protect password:="Password"
 
Upvote 0
Thanks for answering.

There's no problem assigning a macro to an image in a locked worksheet though. The problem is related to a protected chart sheet.
 
Upvote 0
I am unsure if this is related but when you protect a sheet, you can check or uncheck the option to 'Edit objects'.
 
Upvote 0
That's what I was looking for, thanks!

The line I used is as follows.

Code:
Chart1.Protect Password:=secret, DrawingObjects:=False, Contents:=True
 
Upvote 0
I take that back. I thought it was working, but it actually seems to leave the worksheet basically unprotected. The user can still move the chart around, edit the colours, etc.

I can make it work with a normal button to fire the macro but wanted to use a nice-looking icon.
 
Upvote 0
Ok, I've found a way around it now. The solution is to add a blank label directly over the icon and assign the macro to that.
 
Upvote 0
I thought the image was an inserted picture. I have recently done the same thing with a logo in a worksheet. I put a transparent label over the icon of the logo and it compares the user name in the coding against the system userid and unlocks the sheet if it is correct.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

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