LegendEntry and LegendEntries Members
Use the LegendEntries collection to get individual entries from a legend. Use the Legend object’s LegendEntries property to get a reference to this collection. The LegendEntries collection and LegendEntry object have the following members. The key member (shown in bold) is covered in the following reference section:
|
1 Collection only | |
|---|---|
|
2 Object and collection | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the LegendEntry object to format, delete, or get the legend key for entries in a chart legend. For example, the following code makes the color of the legend entry text match the color of the legend key:
Sub LegendEntryMembers( )
Dim chrt As Chart, lg As Legend, le As LegendEntry
' Get the chart.
Set chrt = ActiveChart
' Make sure chart has a legend.
chrt.HasLegend = True
' Get the legend.
Set lg = chrt.Legend
For Each le In lg.LegendEntries
' Set text color to match series color.
le.Font.Color = le.LegendKey.Border.Color
Next
End SubBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access