MrExcel Publishing
Your One Stop for Excel Tips & Solutions

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?


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 "".

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).


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.


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.