Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 8
Default How to delete a specific LegendEntry?

I have some ("dynamic") charts in Excel 2007 where I'd only like to show
certain legend entries. Specifically I have 2n+k series but only want to
show legend entries for n+k of them. I understand how to use the Delete
method of the LegendEntry object but I don't know how to map the index number
of a given LegendEntry to a particular series. For example, suppose all the
LegendEntries I'd like to delete have the word "blah" in them (obviously it's
something else). How do I loop through the LegendEntries collection to
delete the correct LegendEntry objects? Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default How to delete a specific LegendEntry?

Hi,

There is no easy way to do want you describe.

The legend entrys order does not always match the seriescollection
indexing. Within the legend the order is determined by a combination of
the series chart type, axis location and series order.

The help says that the indexing of the legend is purely sequential and
you can not use the name to reference an entry.

Cheers
Andy

Intuitive Analyst wrote:
I have some ("dynamic") charts in Excel 2007 where I'd only like to show
certain legend entries. Specifically I have 2n+k series but only want to
show legend entries for n+k of them. I understand how to use the Delete
method of the LegendEntry object but I don't know how to map the index number
of a given LegendEntry to a particular series. For example, suppose all the
LegendEntries I'd like to delete have the word "blah" in them (obviously it's
something else). How do I loop through the LegendEntries collection to
delete the correct LegendEntry objects? Thanks in advance!


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 8
Default How to delete a specific LegendEntry?

Thanks for the reply. Too bad that's how it works out; it seems then that
the Delete method is thus nearly useless.

"Andy Pope" wrote:

Hi,

There is no easy way to do want you describe.

The legend entrys order does not always match the seriescollection
indexing. Within the legend the order is determined by a combination of
the series chart type, axis location and series order.

The help says that the indexing of the legend is purely sequential and
you can not use the name to reference an entry.

Cheers
Andy

Intuitive Analyst wrote:
I have some ("dynamic") charts in Excel 2007 where I'd only like to show
certain legend entries. Specifically I have 2n+k series but only want to
show legend entries for n+k of them. I understand how to use the Delete
method of the LegendEntry object but I don't know how to map the index number
of a given LegendEntry to a particular series. For example, suppose all the
LegendEntries I'd like to delete have the word "blah" in them (obviously it's
something else). How do I loop through the LegendEntries collection to
delete the correct LegendEntry objects? Thanks in advance!


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default How to delete a specific LegendEntry?

Actually for your purpose, which is simply to delete entries, you could
attempt to identify each entry using code.
Say you change the border and or fill for the series to be deleted. You then
scan for those properties in the legend entries and remove when found.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Intuitive Analyst" wrote in
message ...
Thanks for the reply. Too bad that's how it works out; it seems then that
the Delete method is thus nearly useless.

"Andy Pope" wrote:

Hi,

There is no easy way to do want you describe.

The legend entrys order does not always match the seriescollection
indexing. Within the legend the order is determined by a combination of
the series chart type, axis location and series order.

The help says that the indexing of the legend is purely sequential and
you can not use the name to reference an entry.

Cheers
Andy

Intuitive Analyst wrote:
I have some ("dynamic") charts in Excel 2007 where I'd only like to
show
certain legend entries. Specifically I have 2n+k series but only want
to
show legend entries for n+k of them. I understand how to use the
Delete
method of the LegendEntry object but I don't know how to map the index
number
of a given LegendEntry to a particular series. For example, suppose
all the
LegendEntries I'd like to delete have the word "blah" in them
(obviously it's
something else). How do I loop through the LegendEntries collection to
delete the correct LegendEntry objects? Thanks in advance!


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 8
Default How to delete a specific LegendEntry?

Interesting idea, thanks!

"Andy Pope" wrote:

Actually for your purpose, which is simply to delete entries, you could
attempt to identify each entry using code.
Say you change the border and or fill for the series to be deleted. You then
scan for those properties in the legend entries and remove when found.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Intuitive Analyst" wrote in
message ...
Thanks for the reply. Too bad that's how it works out; it seems then that
the Delete method is thus nearly useless.

"Andy Pope" wrote:

Hi,

There is no easy way to do want you describe.

The legend entrys order does not always match the seriescollection
indexing. Within the legend the order is determined by a combination of
the series chart type, axis location and series order.

The help says that the indexing of the legend is purely sequential and
you can not use the name to reference an entry.

Cheers
Andy

Intuitive Analyst wrote:
I have some ("dynamic") charts in Excel 2007 where I'd only like to
show
certain legend entries. Specifically I have 2n+k series but only want
to
show legend entries for n+k of them. I understand how to use the
Delete
method of the LegendEntry object but I don't know how to map the index
number
of a given LegendEntry to a particular series. For example, suppose
all the
LegendEntries I'd like to delete have the word "blah" in them
(obviously it's
something else). How do I loop through the LegendEntries collection to
delete the correct LegendEntry objects? Thanks in advance!

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete specific rows of data Roger Bell New Users to Excel 3 June 19th 07 08:40 AM
Delete all after a specific date George Excel Discussion (Misc queries) 2 November 17th 06 04:59 PM
Delete rows if specific criteria not met. SITCFanTN Excel Worksheet Functions 3 July 5th 06 12:20 AM
Locate and delete specific cells David Smith Excel Discussion (Misc queries) 1 January 19th 05 04:45 PM
delete row contains specific word in an macro Jean-Francois Excel Discussion (Misc queries) 4 January 11th 05 11:40 PM


All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"