Class Point (Excel VBA)

The class Point represents a single point in a series in a chart.

The main procedures of class Point are Copy, Delete and Select

Set

To use a Point class variable it first needs to be instantiated, for example

Dim lngIndex As Long: lngIndex = 
Dim srs As Series: Set srs = 
Dim pntPoint As Point
Set pntPoint = srs.Points(Index:=lngIndex)

The following procedures can be used to set variables of type Point: Points.Item, Range.Height, Range.Width and Series.Points

For Each

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

Dim rng As Range: Set rng = 
Dim pntHeight As Point
For Each pntHeight In rng.Height
	
Next pntHeight

Methods

These are the main methods of the Point class

Copy - If the point has a picture fill, this method copies the picture to the Clipboard.

Delete - Deletes the series the point belongs to.

Select - Selects the object.

Other Methods

ApplyDataLabels - Applies data labels to a point.

Charts("Chart1").SeriesCollection(1). _ 
 ApplyDataLabels Type:=xlDataLabelsShowLabel

PieSliceLocation - Returns the vertical or horizontal position of a point on a chart item, in points, from the top or left edge of the object to the top or left edge of the chart area.

Properties

ApplyPictToEnd true if a picture is applied to the end of the point or all points in the series.

Charts(1).SeriesCollection(1).ApplyPictToEnd = True

ApplyPictToFront true if a picture is applied to the front of the point or all points in the series.

Charts(1).SeriesCollection(1).ApplyPictToFront = True

ApplyPictToSides true if a picture is applied to the sides of the point or all points in the series.

Charts(1).SeriesCollection(1).ApplyPictToSides = True

DataLabel returns a DataLabel object that represents the data label associated with the point.

With Charts("Chart1").SeriesCollection(3).Points(7) 
 .HasDataLabel = True 
 .ApplyDataLabels type:=xlValue 
 .DataLabel.Font.ColorIndex = 5 
End With

Explosion returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie).

Charts("Chart1").SeriesCollection(1).Points(2).Explosion = 20

Format returns the ChartFormat object.

Has3DEffect true if a point has a three-dimensional appearance.

HasDataLabel true if the point has a data label.

With Charts("Chart1").SeriesCollection(3).Points(7) 
 .HasDataLabel = True 
 .ApplyDataLabels Type:=xlValue 
 .DataLabel.Font.ColorIndex = 5 
End With

Height returns the height, in points, of the object.

InvertIfNegative true if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number.

IsTotal true if the point represents a total.

Left returns a value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.

MarkerBackgroundColor sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts.

With Charts("Chart1").SeriesCollection(1).Points(2) 
 .MarkerBackgroundColor = RGB(0,255,0) ' green 
 .MarkerForegroundColor = RGB(255,0,0) ' red 
End With

MarkerBackgroundColorIndex returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts.

With Charts("Chart1").SeriesCollection(1).Points(2) 
    .MarkerBackgroundColorIndex = 4    'green 
    .MarkerForegroundColorIndex = 3    'red 
End With

MarkerForegroundColor sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts.

With Charts("Chart1").SeriesCollection(1).Points(2) 
 .MarkerBackgroundColor = RGB(0,255,0) ' green 
 .MarkerForegroundColor = RGB(255,0,0) ' red 
End With

MarkerForegroundColorIndex returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts.

With Charts("Chart1").SeriesCollection(1).Points(2) 
 .MarkerBackgroundColorIndex = 4 'green 
 .MarkerForegroundColorIndex = 3 'red 
End With

MarkerSize returns or sets the data-marker size, in points. Can be a value from 2 through 72.

MarkerStyle returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart.

Name returns the object name.

Parent returns the parent object for the specified object. Read-only.

PictureType returns or sets an XlChartPictureType value that represents the way pictures are displayed on a column or bar picture chart.

PictureUnit2 returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored).

SecondaryPlot true if the point is in the secondary section of either a Pie of Pie chart or a Bar of Pie chart. Applies only to points on Pie of Pie charts or Bar of Pie charts.

With Worksheets(1).ChartObjects(1).Chart.SeriesCollection(1) 
 .Points(4).SecondaryPlot = True 
End With

Shadow returns or sets a Boolean value that determines if the object has a shadow.

Top returns a value that represents the distance, in points, from the top edge of the object to the top edge of the chart area.

Width returns the width, in points, of the object.

Points.Count returns a Long value that represents the number of objects in the collection.

Points.Parent returns the parent object for the specified object. Read-only.