AlabasterShelf
New Member
- Joined
- Jun 20, 2014
- Messages
- 5
Hello all,
I have a worksheet that autorefreshes every five minutes. I also have a macro that reformats the range of a chart based on the value of a given cell D1. The value of D1 may change after the autorefresh. I'm very very new to VBA so please bear with me. I tried one bit of code (see below).
Public Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$1" Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).MaximumScale = Worksheets("Summary RYG").Range("D1").Value
End If
End Sub
D1 is set to reference another cell in the worksheet and is an "=XXX" set up instead of an actual number. The program will not trigger if the value of that cell changes from the autorefresh. It will only trigger if I manually retype or re-assign the value of that cell, which defeats the purpose of automation.
If anybody could help me out altering this code, or figuring out some new code, I'd really appreciate it. Thank you in advance.
I have a worksheet that autorefreshes every five minutes. I also have a macro that reformats the range of a chart based on the value of a given cell D1. The value of D1 may change after the autorefresh. I'm very very new to VBA so please bear with me. I tried one bit of code (see below).
Public Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$1" Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).MaximumScale = Worksheets("Summary RYG").Range("D1").Value
End If
End Sub
D1 is set to reference another cell in the worksheet and is an "=XXX" set up instead of an actual number. The program will not trigger if the value of that cell changes from the autorefresh. It will only trigger if I manually retype or re-assign the value of that cell, which defeats the purpose of automation.
If anybody could help me out altering this code, or figuring out some new code, I'd really appreciate it. Thank you in advance.