By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

VB/Excel: Aligning primary and secondary axes

P: 41
Hi guys,

I was wondering if there was a way to automatically scale either axis depending on which axis has the larger range. For example, if the primary axis automatically ranges between 10 and -10, and the secondary ranges between 15 and -5... the macro should automatically scale both axes to

min = -10
max = 15

The reason for this is because I am generating some graphs (2 different chart types) automatically on BOTH axes, but I want them to overlap on the "0" value. Thanks in advance.
Sep 4 '07 #1
Share this Question
Share on Google+
2 Replies


P: 41
Also as a follow-up, is there a way to programmatically fix the size of the chart?
i.e. if I want a chart 5 inches by 3 inches (or in pixels, it does not matter)

Thanks for the help!
Sep 4 '07 #2

P: 41
In case anyone looks at this thread, after fiddling around with VB, I found that if you type in

Sheets(Sheetname).ChartObjects.Add _
(left:=left, top:=top, width:=width, height:=height)

and specify the values for the dimensions, you can set the size of your resulting chart.
Sep 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.