0

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
2
  • What is the problem with your code? what error do you get or what problem results from running it? Commented Aug 28, 2018 at 16:36
  • Names("BLAH").RefersToRange.Offset(1, 0).Name = "BLAH" Commented Aug 28, 2018 at 17:18

1 Answer 1

0

Why not

If ActiveWorkbook.Names("Hzrange").RefersToR1C1 > 0 Then
    With ActiveWorkbook.Names("Hzrange")
        .RefersToR1C1 = Range("Hzrange").Offset(, 1)
    End With
End If
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.