Class Sparkline (Excel VBA)

The class Sparkline represents a single sparkline.

The main procedure of class Sparkline is SparklineGroup.Delete


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

Dim lngIndex As Long: lngIndex = 
Dim sprlng As SparklineGroup: Set sprlng = 
Dim sprlnSparklineGroup As Sparkline
Set sprlnSparklineGroup = sprlng(Index:=lngIndex)

The following procedures can be used to set variables of type Sparkline: SparklineGroup.Item, SparkAxes.Parent, SparkColor.Parent, SparkHorizontalAxis.Parent, Parent, SparklineGroups.Item, SparklineGroups.Add, SparkPoints.Parent and SparkVerticalAxis.Parent

For Each

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

Dim sas As SparkAxes: Set sas = 
Dim sprlnParent As Sparkline
For Each sprlnParent In sas.Parent
Next sprlnParent


The following procedures in this class have been grouped together and are described on a separate theme page

Display/Show with its procedures SparklineGroup.DisplayBlanksAs and SparklineGroup.DisplayHidden


This is the main method of the Sparkline class

SparklineGroup.Delete - Deletes the sparkline group.

Other Methods

SparklineGroup.Modify - Sets the location and the source data for the sparkline group.

ActiveCell.SparklineGroups.Item(1).Modify Location:=Range("$A$1:$A$3"), SourceData:="Sheet1!B1:D3"


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

SourceData returns or sets the range that contains the source data for a single sparkline.

SparklineGroup.Axes returns the associated SparkAxes object.

SparklineGroup.Count returns the number of sparklines in the sparkline group.

SparklineGroup.DateRange gets or sets the date range for the sparkline group.

SparklineGroup.Item returns a Sparkline object.

SparklineGroup.LineWeight gets or sets the thickness of the sparklines in the sparkline group. Read/write.

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

SparklineGroup.PlotBy returns or sets how to plot the sparkline when the data on which it is based is in a square-shaped range.

SparklineGroup.Points returns the associated SparkPoints object for the sparkline group.

SparklineGroup.SeriesColor returns a FormatColor object that represents the main series color for the sparkline group.

SparklineGroup.SourceData returns or sets the range that contains the source data for the sparkline group.

SparklineGroup.Type gets or sets the type of sparkline for the group.