Hello, quick question from a novice.
I have a sheet named Dashboard, where $O$4 = MIN and $P$4 = MAX of a specific range; chart is "Chart 5"
I want to have the Y axis adjust to these values instead of 0 and some max range that Excel sets. I don't want to set the Y axis manually each time for different values.
I found a snippet online and tried to modify it but am getting errors.
Original code:
My code:
I'm getting run-time error '424' Object required.
Any help is appreciated.
Thanks,
Craig
I have a sheet named Dashboard, where $O$4 = MIN and $P$4 = MAX of a specific range; chart is "Chart 5"
I want to have the Y axis adjust to these values instead of 0 and some max range that Excel sets. I don't want to set the Y axis manually each time for different values.
I found a snippet online and tried to modify it but am getting errors.
Original code:
Code:
[COLOR=#000000][FONT=Arial]Sub adjustscales()
[/FONT][/COLOR][COLOR=#000000][FONT=Arial]Sheet1.ChartObjects("Chart 1").Chart.Axes(xlValue).MinimumScale = Sheet1.Range("A1")[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]Sheet1.ChartObjects("Chart 1").Chart.Axes(xlValue).MaximumScale = Sheet1.Range("A2")[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]End Sub[/FONT][/COLOR]
My code:
Code:
[COLOR=#000000][FONT=Arial][COLOR=#222222][FONT=Verdana]Sub adjustscales()[/FONT][/COLOR][/FONT][/COLOR]
Dashboard.ChartObjects("Chart 5").Chart.Axes(ylValue).MinimumScale = Dashboard.Range("O4")
Dashboard.ChartObjects("Chart 5").Chart.Axes(ylValue).MaximumScale = Dashboard.Range("P4")
End Sub
I'm getting run-time error '424' Object required.
Any help is appreciated.
Thanks,
Craig