ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Re scale primary and secondary y axis using sliders request (https://www.excelbanter.com/charts-charting-excel/166745-re-scale-primary-secondary-y-axis-using-sliders-request.html)

joecrabtree

Re scale primary and secondary y axis using sliders request
 
To all,

I have an xy chart with a primary and secondary y axis. I would like
to be able to alter the scale of the primary and secondary y axis
independently using sliders ( one for each axis ). How is this
possible? Do I need to write a macro, or is there some other way to
control it?

Thanks in advance for your help,

Regards,

Joseph Crabtree

Andy Pope

Re scale primary and secondary y axis using sliders request
 
Hi,

That will require VBA code.

Assuming you add 2 scrollbars from the Control Toolbox to the worksheet you
could use the following code.
This will change the primary or Secondary Y axis of the 1st chart object on
the worksheet.

Private Sub ScrollBar1_Change()
' Primary Y Axis
ActiveSheet.ChartObjects(1).Chart.Axes(2, 1).MaximumScale =
ScrollBar1.Value

End Sub

Private Sub ScrollBar2_Change()
' Secondary Y Axis
ActiveSheet.ChartObjects(1).Chart.Axes(2, 2).MaximumScale =
ScrollBar2.Value

End Sub

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"joecrabtree" wrote in message
...
To all,

I have an xy chart with a primary and secondary y axis. I would like
to be able to alter the scale of the primary and secondary y axis
independently using sliders ( one for each axis ). How is this
possible? Do I need to write a macro, or is there some other way to
control it?

Thanks in advance for your help,

Regards,

Joseph Crabtree



joecrabtree

Re scale primary and secondary y axis using sliders request
 
On Nov 20, 1:47 pm, "Andy Pope" wrote:
Hi,

That will require VBA code.

Assuming you add 2 scrollbars from the Control Toolbox to the worksheet you
could use the following code.
This will change the primary or Secondary Y axis of the 1st chart object on
the worksheet.

Private Sub ScrollBar1_Change()
' Primary Y Axis
ActiveSheet.ChartObjects(1).Chart.Axes(2, 1).MaximumScale =
ScrollBar1.Value

End Sub

Private Sub ScrollBar2_Change()
' Secondary Y Axis
ActiveSheet.ChartObjects(1).Chart.Axes(2, 2).MaximumScale =
ScrollBar2.Value

End Sub

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excelhttp://www.andypope.info"joecrabtree" wrote in message

...



To all,


I have an xy chart with a primary and secondary y axis. I would like
to be able to alter the scale of the primary and secondary y axis
independently using sliders ( one for each axis ). How is this
possible? Do I need to write a macro, or is there some other way to
control it?


Thanks in advance for your help,


Regards,


Joseph Crabtree- Hide quoted text -


- Show quoted text -


Thanks for that. Is there any way that I can define the minimum as
always 0, and have an upper maximum of 6000?

Thanks

Andy Pope

Re scale primary and secondary y axis using sliders request
 
You would need to set the Max and Min properties of the scroll bars.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"joecrabtree" wrote in message
...
On Nov 20, 1:47 pm, "Andy Pope" wrote:
Hi,

That will require VBA code.

Assuming you add 2 scrollbars from the Control Toolbox to the worksheet
you
could use the following code.
This will change the primary or Secondary Y axis of the 1st chart object
on
the worksheet.

Private Sub ScrollBar1_Change()
' Primary Y Axis
ActiveSheet.ChartObjects(1).Chart.Axes(2, 1).MaximumScale =
ScrollBar1.Value

End Sub

Private Sub ScrollBar2_Change()
' Secondary Y Axis
ActiveSheet.ChartObjects(1).Chart.Axes(2, 2).MaximumScale =
ScrollBar2.Value

End Sub

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excelhttp://www.andypope.info"joecrabtree"
wrote in message

...



To all,


I have an xy chart with a primary and secondary y axis. I would like
to be able to alter the scale of the primary and secondary y axis
independently using sliders ( one for each axis ). How is this
possible? Do I need to write a macro, or is there some other way to
control it?


Thanks in advance for your help,


Regards,


Joseph Crabtree- Hide quoted text -


- Show quoted text -


Thanks for that. Is there any way that I can define the minimum as
always 0, and have an upper maximum of 6000?

Thanks




All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com