I'm trying to cycle through all the sparklines (500+) in an excel spreadsheet.
I then need to set the vertical range to the value in a cell to the left of each sparkline. e.g. Cell A1 has the value '5'. Cell A2 has the sparkline in it. I need the vertical range of the sparkline set to 5.
The sparklines are ungrouped (ie one sparkline in each sparkline group)
I've got as far as the code below but I can't seem to figure out how to refer to the location of the sparkline, and then offset it.
Any help greatly appreciated!
Dim i As Integer
Dim SpLG As SparklineGroup
Dim SpLG_ref As String
Dim SpLG_range as Range
For i = 1 To Cells.SparklineGroups.Count
Set SpLG = Cells.SparklineGroups(i)
SpLG_ref = SpLG.Location.Address
SpLG_range2 = Range("SpLG_range").Offset(0, -1) << ERROR
SpLG.Axes.Vertical.MaxScaleType = xlSparkScaleCustom
SpLG.Axes.Vertical.CustomMaxScaleValue = SpLG_range2.Value
Next i