I found the following code (in the office docs) which allows me to change the axis colour of a group of sparklines:
Sub AxisColor()
'The sparkline group
Dim oSparkGroup As SparklineGroup
'Loop through the sparkline groups on the sheet
For Each oSparkGroup In Range("A2:C2").SparklineGroups
'Show the axis
oSparkGroup.Axes.Horizontal.Axis.Visible = True
'Set the color of the axis to the color of cell A8
oSparkGroup.Axes.Horizontal.Axis.Color.Color = Range("A8").Interior.Color
Next oSparkGroup
End Sub
However I have a (single) group of 60 sparklines and the axis is going to either be above or below the line (it differs case by case). I want to have different colours for an axis that is above all the data (i.e. a max) and for an axis that is below all the data (i.e. a min). Is this possible?
I suspect that I might need to break the sparkline group into 60 individual groups. If someone can show me how to do that (via VBA or otherwise) then I can easily adapt the code above for my purposes.
if
in before setting the color if you want a different color depending on the location.For Each oSparkGroup In Range("A2:C2").SparklineGroups