Certain values in a sparkline can be highlighted, and colors can be customized. Here is an example:
Sub FormatLineSparkline()
ThisWorkbook.Worksheets("Sheet8").Activate
With Range("A11").SparklineGroups
.Add xlSparkLine, "A1:A10"
.Item(1).SeriesColor.ThemeColor = 2
.Item(1).Points.Markers.Visible = True
.Item(1).Points.Markers.Color.ThemeColor = 10
.Item(1).Points.Negative.Visible = True
.Item(1).Points.Negative.Color.ThemeColor = 9
End With
End Sub
![]()
Explanation:
First, the color of the sparkline is changed via the ThemeColor sub-property of the SeriesColor property for the first element in the SparklineGroups collection. The possible theme colors will be demonstrated in a subsequent example.
Data points are given visible markers with a specific color. This is controlled by properties of the Markers object within the Points collection: first, the Visible property is set to True, then the ThemeColor sub-property of the Color property is set to specify the marker color.
Negative points are also highlighted and colored using the Negative property, with visibility enabled and a theme color assigned.