Code to Change Y-Axis not firing anymore Excel VBA

theteerex

Board Regular
Joined
Mar 2, 2018
Messages
102
My code for changing the Y-Axis was working perfectly yesterday yet does nothing today.
It monitors the minimum and max values in static cells and changes the scale based on the code below.
I know the change event is the correct one as it was working yesterday.
Could I ensure that it always runs without resorting to using a button?
There is no error message either when I run it.



Code:
Option Explicit
            Sub ChangeAxisScales_Calculate()
               Dim objCht As ChartObject
               For Each objCht In Sheets("Price Bridge Chart").ChartObjects
                  With objCht.Chart
                     ' Value (Y) Axis
                     With .Axes(xlValue)
                        .MaximumScale = ActiveSheet.Range("L34").Value + 2000000 
                        .MinimumScale = ActiveSheet.Range("K34").Value - 2000000 
                        MsgBox "Max = " & .MaximumScale [COLOR=#008000]'- For Error Checking[/COLOR]
                        MsgBox "Min = " & .MinimumScale [COLOR=#008000]' - For Error Checking[/COLOR]
                        .MajorUnit = 250000 'Chart horizontal lines
                        End With
                  End With
               Next objCht
            End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,247
Messages
6,171,004
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top