Class SparklineGroup (Excel VBA)

The class SparklineGroup represents a group of sparklines.

Set

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

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

SparklineGroup class variables can be set using the Range.SparklineGroups procedure.

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.Parent

Returns the Range object for the specified object. Read-only.

SparklineGroups.Ungroup

Ungroups the sparklines in the selected sparkline group.

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