VBA - Axis Option

Solved
zivodul8 Posted messages 248 Status Member -  
zivodul8 Posted messages 248 Status Member -
Hello,

I would like to know the VBA code that allows you to set the value at which the vertical axis crosses the horizontal axis in a chart (and vice versa)?

It's easy to do manually, but in VBA...

Thank you very much!

P.S.: I would also appreciate the code for the minimum and maximum of the axes :)

2 answers

ccm81 Posted messages 11033 Status Member 2 434
 
Hello
for a scatter plot

 With Sheets(1).ChartObjects(1).Chart.Axes(xlCategory) .MinimumScale = -5 .MaximumScale = 12 .Crosses = xlCustom .CrossesAt = -3 End With With Sheets(1).ChartObjects(1).Chart.Axes(xlValue) .MinimumScale = -2 .MaximumScale = 30 .Crosses = xlCustom .CrossesAt = -1 End With

but the easiest way is to use the macro editor
Tools/macros/new macro
you execute your changes
Tools/macros/stop recording
and you modify the code
have a good continuation
0
zivodul8 Posted messages 248 Status Member 22
 
Thank you very much, it’s perfect!

I had already tried this method to find the code, but it only coded the axis selection for me. Maybe it’s because I double-clicked on the axis?

In any case, thank you, and also for the quick response =)
0