Kelvin Stott
Active Member
- Joined
- Oct 26, 2010
- Messages
- 338
Hi All,
I have a protected worksheet that includes several embedded charts, one of which I enable users to update with the following macro:
I would also like to enable users to copy that sheet, including all the charts, and to update that one particular chart with the macro. However the macro refers to specific chart reference "Chart 47", which changes when I copy the sheet, so that I get the following error:
Is there any way I can assign some alternative label to that one chart in the original sheet, which will be retained when the sheet is copied so that the macro can identify the appropriate chart in each sheet?
Please help!
I have a protected worksheet that includes several embedded charts, one of which I enable users to update with the following macro:
Code:
Private Sub Rectangle55_Click()
With ActiveSheet
.Calculate
.Unprotect Password:="mypassword"
.ChartObjects("[B]Chart 47[/B]").Chart.Axes(xlValue).CrossesAt = Range("Q497")
.Protect Password:="mypassword", _
UserInterfaceOnly:=True, DrawingObjects:=True, Contents:=True
.EnableOutlining = True
End With
End Sub
I would also like to enable users to copy that sheet, including all the charts, and to update that one particular chart with the macro. However the macro refers to specific chart reference "Chart 47", which changes when I copy the sheet, so that I get the following error:
Run-time error '1004':
Unable to get the ChartObjects property of the Worksheet class
Is there any way I can assign some alternative label to that one chart in the original sheet, which will be retained when the sheet is copied so that the macro can identify the appropriate chart in each sheet?
Please help!