I am trying to automate a rolling calendar spreadsheet that tracks various metrics. The script I would like to write would shift the selected range in a named each time it is ran.
I did have success incrementing the spark lines using this macro:
If Sheet2.Range("E5").SparklineGroups.Count > 0 Then
With Sheet2.Range("E5").SparklineGroups.Item(1)
.SourceData = "'" & Range(.SourceData).Parent.Name & "'!" & Range(.SourceData).Offset(, 1).Address
End With
End If
However, I am stuck referencing the defined name Hzrange using a similar macro below. I am very new to VBA and any help is appreciated as always.
If ActiveWorkbook.Names("Hzrange").RefersToR1C1 > 0 Then
With ActiveWorkbook.Names("Hzrange")
.RefersToR1C1 = "'" & Range(.RefersToR1C1).Parent.Name & "'!" & Range(.RefersToR1C1).Offset(, 1).Address
End With
End If
Names("BLAH").RefersToRange.Offset(1, 0).Name = "BLAH"