Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
rrj rrj is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to protect worksheet from edit my query Daniel Excel Discussion (Misc queries) 0 February 14th 08 07:16 PM
Can I Protect Just A Few Cells On A Worksheet? Joe Miller Excel Discussion (Misc queries) 3 August 14th 06 02:37 PM
To Protect Excel documents and allowing only few cells to edit DHANRAJ Excel Worksheet Functions 1 March 29th 06 03:18 PM
is there a way to protect a range of cells on a worksheet? vevans Excel Discussion (Misc queries) 1 February 17th 05 05:30 PM
Protect Macro from Edit Bin[_2_] Excel Programming 2 April 9th 04 12:57 AM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"