VBA_Newbie
Active Member
- Joined
- Jan 7, 2005
- Messages
- 258
Hi folks,
I have the following code which changes the max scale in a chart on the active worksheet when ever a calculate is made on that worksheet. Does anyone know how I can modify this so that if I'm on a different worksheet and make a change that affects the worksheet with the chart, I don't get an error code.
It think I have to change the line "ActiveSheet.ChartObjects("Chart 9").Activate" but am not quite sure how.
Many thanks!
I have the following code which changes the max scale in a chart on the active worksheet when ever a calculate is made on that worksheet. Does anyone know how I can modify this so that if I'm on a different worksheet and make a change that affects the worksheet with the chart, I don't get an error code.
It think I have to change the line "ActiveSheet.ChartObjects("Chart 9").Activate" but am not quite sure how.
Many thanks!
Code:
Private Sub Worksheet_Calculate()
ActiveSheet.ChartObjects("Chart 9").Activate
With ActiveChart.Axes(xlValue)
.MaximumScale = ActiveSheet.Range("W26").Value
End With
End Sub