PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Charting How can I "align middle" the legend and plot area?

Reply

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

 
Thread Tools Rate Thread
Old 12-11-2007, 04:11 PM   #1
=?Utf-8?B?U3RvbnlDcmVla2Vy?=
Guest
 
Posts: n/a
Default How can I "align middle" the legend and plot area?


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?
  Reply With Quote
Old 12-11-2007, 04:46 PM   #2
Andy Pope
Guest
 
Posts: n/a
Default Re: How can I "align middle" the legend and plot area?

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

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"StonyCreeker" <StonyCreeker@discussions.microsoft.com> wrote in message
news:308C66A2-42CC-41F2-B971-ACF60EC67A02@microsoft.com...
> 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?


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off