Protection for Chart

  • Thread starter Thread starter mangesh_yadav
  • Start date Start date
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
 
You could unprotect and reprotect the chart within the code, e.g.:

ActiveSheet.Unprotect
'your code
ActiveSheet.Protect
 
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
 
Thanks to both, Debra and Jon. Its working nicely now. Couldn't repl
earlier as the site was down.

Manges
 
Back
Top