Protection for Chart

M

mangesh_yadav

I have a zoom feature for my chart. There is a spinner on my chart, s
when i increase or decrease the value of the spinner, a macro execute
and assigns new numbers to the scale of the graph. But the problem is
when the chartsheet is protected, I cannot assign new numbers to th
scale.

Is there a way I can achieve this...?

My code:

ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = retMinScale

the code fails at the third line above i.e. "Unable to set th
MinimumScale property of the Axis class" as the sheet is protected.

While protecting the chart if uncheck the 'contents' box, it work
properly, but then the user can do other harm to the worksheet, which
don't want.

0 Manges
 
D

Debra Dalgleish

You could unprotect and reprotect the chart within the code, e.g.:

ActiveSheet.Unprotect
'your code
ActiveSheet.Protect
 
J

Jon Peltier

Also, when protecting the sheet, use the argument
UserInterfaceOnly:=True, so your code does not need to repeat this
frequently. You need to protect the sheet once with this argument, so I
usually do it when the workbook opens.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Debra said:
You could unprotect and reprotect the chart within the code, e.g.:

ActiveSheet.Unprotect
'your code
ActiveSheet.Protect
 
M

mangesh_yadav

Thanks to both, Debra and Jon. Its working nicely now. Couldn't repl
earlier as the site was down.

Manges
 

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