J
jimnwilson
Hi,
I have a multi sheet workbook that has spin buttons on two of th
sheets. I use one sheet with a chart that has its y axis min and ma
scaling updated from data recalculated after I use the spin button. Th
code works fine until I use a spin button on another sheet, which seem
to trigger the worksheet_calculate event from the other sheet with th
chart. I then get an error message because the code can't find th
chart. I need to know how to disable this code when I am working on th
other sheet.
I am not a programmer by any stretch, so any help would be appreciated
Here is the code from the main worksheet, all of which I obtained b
web searches (I'm learning!) :
==============================================
Private Sub Worksheet_Calculate()
mySelection = ActiveWindow.RangeSelection.Address
UpdateScale
Range(mySelection).Select
End Sub
Sub UpdateScale()
'
' UpdateScale Code
' by Ray Blake
'
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart.Axes(xlValue)
.MinimumScale = Range("$J$2").Value
.MaximumScale = Range("$I$2").Value
.MajorUnit = (.MaximumScale - .MinimumScale) / 10
End With
End Su
I have a multi sheet workbook that has spin buttons on two of th
sheets. I use one sheet with a chart that has its y axis min and ma
scaling updated from data recalculated after I use the spin button. Th
code works fine until I use a spin button on another sheet, which seem
to trigger the worksheet_calculate event from the other sheet with th
chart. I then get an error message because the code can't find th
chart. I need to know how to disable this code when I am working on th
other sheet.
I am not a programmer by any stretch, so any help would be appreciated
Here is the code from the main worksheet, all of which I obtained b
web searches (I'm learning!) :
==============================================
Private Sub Worksheet_Calculate()
mySelection = ActiveWindow.RangeSelection.Address
UpdateScale
Range(mySelection).Select
End Sub
Sub UpdateScale()
'
' UpdateScale Code
' by Ray Blake
'
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart.Axes(xlValue)
.MinimumScale = Range("$J$2").Value
.MaximumScale = Range("$I$2").Value
.MajorUnit = (.MaximumScale - .MinimumScale) / 10
End With
End Su