ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Crossing Axis Values (https://www.excelbanter.com/charts-charting-excel/238233-crossing-axis-values.html)

Alonso[_2_]

Crossing Axis Values
 
Hi everyone

I have a chart where the values can be modified depending on some filters

What I need is that the values where the axis crosses change automatically
as well depending on the value of one cell for the X axis and another cell
for the Y axis
Instead of manually modify the values

is this posible??

Luke M

Crossing Axis Values
 
You'd need to do this using VBA. An example code that could be run with the
chart selected:

Sub ChartAxis()
With ActiveChart
'This is the y-axis
.Axes(xlCategory).CrossesAt = Range("A2").Value

'This is the x-axis
.Axes(xlValue).CrossesAt = Range("A3").Value
End With
End Sub


Depending on whether your chart is on a seperate sheet or not, you could
automate this using either a Chart_Activate event, or a Worksheet_Change
event.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Alonso" wrote:

Hi everyone

I have a chart where the values can be modified depending on some filters

What I need is that the values where the axis crosses change automatically
as well depending on the value of one cell for the X axis and another cell
for the Y axis
Instead of manually modify the values

is this posible??


Alonso[_2_]

Crossing Axis Values
 
Thanks Luke

I guess the same goes for the max and min values for each axis, right??
could you provide the VBA for this??

and have all in one button
so after the filters are used
use the button and update the XY chart??



"Luke M" wrote:

You'd need to do this using VBA. An example code that could be run with the
chart selected:

Sub ChartAxis()
With ActiveChart
'This is the y-axis
.Axes(xlCategory).CrossesAt = Range("A2").Value

'This is the x-axis
.Axes(xlValue).CrossesAt = Range("A3").Value
End With
End Sub


Depending on whether your chart is on a seperate sheet or not, you could
automate this using either a Chart_Activate event, or a Worksheet_Change
event.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Alonso" wrote:

Hi everyone

I have a chart where the values can be modified depending on some filters

What I need is that the values where the axis crosses change automatically
as well depending on the value of one cell for the X axis and another cell
for the Y axis
Instead of manually modify the values

is this posible??



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

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