Explicit primary axis control in VBA

erupter

New Member
Joined
Oct 22, 2011
Messages
1
Hello.

You'll find a file attached, it's an example of a dynamic chart.
You can zoom and pan (horizontally).
Problem: depending on unknown circumstances excel may wish to plot some white space either before, after or both before and after the actual data.

The fact that it's not a problem in my code stems from playing with it: sometimes you'll get a decent plot (more or less no white space at the sides) and sometimes you'll get a horrible plot (lots of white spaces either side).

So I thought: since I know the data start and end, I could set the primary axis min and max.
But I can't control them.

Opening in vba any parent that's supposed to contain the charts, results in a chart object of zero childs. It's like the workbook does not have any chart at all!

So I can't access the chart's properties and so I can't explicitly set the axis min/max.

I'm very open to suggestions for this problem. I hope you can help me somehow.


Edit: ok I can't post attachments... right, so... here is a link, it's a zip with the xls in it

dyn_chart.jpg
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,224,352
Messages
6,178,066
Members
452,822
Latest member
MtC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top