Class Sparkline (Excel VBA)

The class Sparkline represents a single sparkline. To use a Sparkline class variable it first needs to be instantiated, for example


Dim sprln as Sparkline
Set sprln = ActiveCell.SparklineGroups(1)(Index:=1)

For Each

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


Dim sprlnParent As Sparkline
For Each sprlnParent In ActiveCell.SparklineGroups.Parent
	
Next sprlnParent

Location


ActiveCell.SparklineGroups(1)(1).Location =

ModifyLocation

Modifies the location of a single sparkline.

ModifyLocation (Range)

Range: The cell that contains the sparkline.


ActiveCell.SparklineGroups(1)(1).ModifyLocation Range:=

ModifySourceData

Modifies the source data for a single sparkline.

The data source range for a single sparkline must be continuous.

ModifySourceData (Formula)

Formula: The range that contains the source data.


Dim strFormula As String: strFormula = 
ActiveCell.SparklineGroups(1)(1).ModifySourceData Formula:=strFormula

SourceData

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

The data source range for a single sparkline must be continuous.


ActiveCell.SparklineGroups(1)(1).SourceData =