Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protect worksheet cells but still allow macro to edit chartproperties
I have a worksheet with calculations and charts.
The calculations refer to data in a separate worksheet that can be overwritten by loading new data from a csv file. I've written a macro to do this. When I load the data I rescale the charts from the macro to best visualise the new data set There are then some parameters next to the charts which the user can modify to optimise the result. Everything works fine, but now I want to protect the calculations. I can choose which cells to lock/unlock and then protect the sheet. The chart axis scales can still be edited by the user, but the problem is that the macro to rescale the chart then fails. In its simplest form it looks like this ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.Axes(xlValue).MinimumScale = "something" I get the message Run-time error '1004', application-defined or object- defined error. Its the activate that fails, not the scale change. Its there any way of working around this? Thanks Richard |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protect worksheet cells but still allow macro to edit chart properties
Hi Richard
You have to unprotect first: pWord = "JustMe" ActiveSheet.Unprotect Password:=pWord ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.Axes(xlValue).MinimumScale = "something" ActiveSheet.Protect Password:="pWord" Hopest this helps --- Per "rrj" skrev i meddelelsen ... I have a worksheet with calculations and charts. The calculations refer to data in a separate worksheet that can be overwritten by loading new data from a csv file. I've written a macro to do this. When I load the data I rescale the charts from the macro to best visualise the new data set There are then some parameters next to the charts which the user can modify to optimise the result. Everything works fine, but now I want to protect the calculations. I can choose which cells to lock/unlock and then protect the sheet. The chart axis scales can still be edited by the user, but the problem is that the macro to rescale the chart then fails. In its simplest form it looks like this ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.Axes(xlValue).MinimumScale = "something" I get the message Run-time error '1004', application-defined or object- defined error. Its the activate that fails, not the scale change. Its there any way of working around this? Thanks Richard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to protect worksheet from edit my query | Excel Discussion (Misc queries) | |||
Can I Protect Just A Few Cells On A Worksheet? | Excel Discussion (Misc queries) | |||
To Protect Excel documents and allowing only few cells to edit | Excel Worksheet Functions | |||
is there a way to protect a range of cells on a worksheet? | Excel Discussion (Misc queries) | |||
Protect Macro from Edit | Excel Programming |