How can I "align middle" the legend and plot area?

S

StonyCreeker

I'd like to vertically center align the plot area and the legend but can't
select them at the same time. Is it possible to do this or do I have to
eyeball it?
 
A

Andy Pope

Hi,

You can not select both the plotarea and the legend in order to align them.
If you use Right click > Chart Options > Legend > Bottom. The legend will
align horizontally with the middle of the plot area.
You will have to eyeball the vertical alignment and the same for the plot
area alignment.

Or you could use code. Uncomment line if you want the plotarea centered in
chartobject.
Place code in a standard code module.

Sub x()

With ActiveChart
' center align plotarea in chart object
' .PlotArea.Left = (.ChartArea.Width - .PlotArea.Width) / 2
' .PlotArea.Top = (.ChartArea.Height - .PlotArea.Height) / 2
.Legend.Left = .PlotArea.InsideLeft + ((.PlotArea.InsideWidth -
..Legend.Width) / 2)
End With
End Sub

Cheers
Andy
 

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