Class SparklineGroup (Excel VBA)

The class SparklineGroup represents a group of sparklines.

Item

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

Dim sprlng as SparklineGroup
Set sprlng = ActiveCell.SparklineGroups(Index:=1)

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

For Each

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

Dim sprlng As SparklineGroup
For Each sprlng In ActiveCell.SparklineGroups
	
Next sprlng

SparklineGroups.Add

Creates a new sparkline group and returns a SparklineGroup object.

Add (Type, SourceData)

Range("$A$1:$A$4").SparklineGroups.Add Type:=xlSparkColumn, SourceData:= _ 
 "Sheet2!B1:E4"

Arguments

The following arguments are required:

Type (XlSparkType) - The type of sparkline.

Possible Values are xlSparkColumn - A column chart sparkline, xlSparkColumnStacked100 - A win/loss chart sparkline, xlSparkLine - A line chart sparkline.

SourceData (String) - Represents the range to use to create the sparkline.

SparklineGroups.Clear

Clears the selected sparklines.

ActiveCell.SparklineGroups.Clear

SparklineGroups.ClearGroups

Clears the selected sparkline groups.

ActiveCell.SparklineGroups.ClearGroups

SparklineGroups.Count

Returns the count of sparkline groups in the associated Range object.

Dim lngCount As Long
lngCount = ActiveCell.SparklineGroups.Count

SparklineGroups.Group

Groups the selected sparklines.

Group (Location)

Location: The location of the first cell in the group.

Range("A1:A4").SparklineGroups.Group Location:=Range("A1")

SparklineGroups.Item

Returns a SparklineGroup object from a collection.

Item (Index)

Index: Specifies the position of an element in the collection.

Dim sprlngItem As SparklineGroup
Set sprlngItem = ActiveCell.SparklineGroups(Index:=1)

SparklineGroups.Ungroup

Ungroups the sparklines in the selected sparkline group.

Range("A1:A4").SparklineGroups.Ungroup