Item method (Excel Graph)
The Item method as it applies to the Axes, ChartGroups, DataLabels, LegendEntries, Points, SeriesCollection, and Trendlines collections.
Returns a single Axis object from an Axes collection.
expression.Item (Type, AxisGroup)
expression Required. An expression that returns an Axes collection.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Type | Required | XlAxisType | The axis type. Can be one of these XlAxisType constants: xlCategory, xlSeriesAxis (valid only for 3D charts), or xlValue. |
AxisGroup | Optional | XlAxisGroup | The axis group. Can be one of these XlAxisGroup constants: xlSecondary or xlPrimary (default). |
This example sets the title text for the category axis on Chart1.
With Charts("chart1").Axes.Item(xlCategory)
.HasTitle = True
.AxisTitle.Caption = "1994"
End With
Returns a single ChartGroup object from a ChartGroups collection.
expression.Item (Index)
expression Required. An expression that returns a ChartGroups collection.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Index | Required | Variant | The index number of the chart group. |
This example adds drop lines to chart group one on chart sheet one.
Charts(1).ChartGroups.Item(1).HasDropLines = True
Returns a single DataLabel object from a DataLabels collection.
expression.Item (Index)
expression Required. An expression that returns a DataLabels collection.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Index | Required | Variant | The name or index number of the data label. |
This example sets the number format for the fifth data label in series one in embedded chart one on worksheet one.
Worksheets(1).ChartObjects(1).Chart _
.SeriesCollection(1).DataLabels.Item(5).NumberFormat = "0.000"
Returns a single LegendEntry object from a LegendEntries collection.
expression.Item (Index)
expression Required. An expression that returns a LegendEntries collection.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Index | Required | Variant | The index number of the legend entry. |
This example changes the font for the text of the legend entry at the top of the legend (this is usually the legend for series one) in embedded chart one on Sheet1.
Worksheets("sheet1").ChartObjects(1).Chart _
.Legend.LegendEntries.Item(1).Font.Italic = True
Returns a single Point object from a Points collection.
expression.Item (Index)
expression Required. An expression that returns a Points collection.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Index | Required | Long | The index number of the point. |
This example sets the marker style for the third point in series one in embedded chart one on worksheet one. The specified series must be a 2D line, scatter, or radar series.
Worksheets(1).ChartObjects(1).Chart. _
SeriesCollection(1).Points.Item(3).MarkerStyle = xlDiamond
Returns a single Series object from a SeriesCollection collection.
expression.Item (Index)
expression Required. An expression that returns a SeriesCollection collection.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Index | Required | Variant | The name or index number of the series. |
This example provides two lines of code that are equivalent.
myChart.SeriesCollection.Item(1)
myChart.SeriesCollection(1)
Returns a single Trendline object from a Trendlines collection.
expression.Item (Index)
expression Required. An expression that returns a Trendlines collection.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Index | Optional | Variant | The name or index number of the trendline. |
This example sets the number of units that the trendline on Chart1 extends forward and backward. The example should be run on a 2D column chart that contains a single series with a trendline.
With Charts("Chart1").SeriesCollection(1).Trendlines.Item(1)
.Forward = 5
.Backward = .5
End With
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.