Archive of Mr Excel Message Board

Check out Bill's new book on Charts and
Graphs for Microsoft Office Excel 2007
Back to Charting for Excel archive index
Back to archive home

Can It Be Done? Remove Selected Entries From Chart Legend
Posted by Steve on February 15, 2002 3:27 PM
Is it possible to remove selected (not all) entries from a chart legend using VBA (or manually, for that matter)? I often place reference lines on plots as additional series (so they will move correctly if the axis scale is changed) and don't want a legend entry to show up for them.
Any ideas?

Re: Can It Be Done? Remove Selected Entries From Chart Legend
Posted by Bob Umlas on February 18, 2002 1:09 PM
Manually: select the series, and make the first field of the =SERIES formula be "".

Re: Can It Be Done? Remove Selected Entries From Chart Legend
Posted by Steve on February 23, 2002 12:33 AM
Thanks, but that only gets rid of the legend text for the series and leaves the symbol/line in the legend (I want to remove the entire legend entry for the series).

Re: Can It Be Done? Remove Selected Entries From Chart Legend
Posted by Mike on March 04, 2002 8:21 AM
Not possible as far as I know. I had the same problem and all I did was the suggestion above, and then I made the symbol the same as the background color, for instance if the legend or chart background color is white then make the symbol white, it is still there but does not show up.

Re: Can It Be Done? Remove Selected Entries From Chart Legend
Posted by hlmilk on April 21, 2002 1:07 AM
I think it may be possible. Obtain the Legend property from the chart object, after witch get the LegendEntries property and get the legend entry that you want to delete. Call the Delete() method of that legend entry and it will be gone!
The legend property is supposed to be non-writable, but somehow it can be done.

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.