Crossing Axis Values

A

Alonso

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??
 
L

Luke M

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.
 
A

Alonso

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??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top