Trying to center align a resized Plot Area in a resized Chart Area.
1. CHART AREA
The Chart Area's Border Line Weight = 6.
So I order to have the Chart Area cover the exact selected cell range horizontally, I resized the Chart Area.
I did this by counting the Pixels from Left, with the cells 65 Pixels wide:
2. PLOT AREA
Found this code by Andy Pope:
https://www.excelbanter.com/charts-c...plot-area.html
I want the Plot Area to be as wide as possible (as wide as the Chart Area allows) and place it in the Chart Area's Center.
So I added these lines, using my Pixelcount from the resized Chart Area:
Somehow, this doesn't add up, the numbers don't work. The Plot Area is not centered.
It seems, that the resized Chart Area causes the irritation.
So I removed "Plot Resize" from the "Create" Macro, recorded another one to have some values
and finally ran these recorded values in a second Macro:
This seems to do the job, more or less, at Zoom 400, you can see, it's not exact.
And I have to record values by eyeballing and run a second Macro.
How can I make this work in one run? Without using the mouse?
(This is what I'm really starting to like about VBA: not using the mouse.)
And if that's not possible, how can I make these two lines work in the second Macro:
(Couldn't work out, what to add at the beginning, to make it work by itself.)
Thanks a lot!
Toni
Bookmarks