Class LegendEntries (Excel VBA)

A collection of all the LegendEntry objects in the specified chart legend. To use a LegendEntries class variable it first needs to be instantiated, for example


Dim les as LegendEntries
Set les = ActiveChart.Legend.LegendEntries()

For Each

Here is an example of processing the LegendEntries items in a collection.


Dim lgneLegendEntrie As LegendEntry
For Each lgneLegendEntrie In ActiveChart.Legend.LegendEntries()
	
Next lgneLegendEntrie

Count

Returns a Long value that represents the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveChart.Legend.LegendEntries.Count

Item

Returns a single object from a collection.

Item (Index)

Index: The index number for the object.


Dim lgne As LegendEntry
Set lgne = ActiveChart.Legend.LegendEntries(Index:=1)