Reputation: 3
Can you help me with this? I want to generate a minimum axis value for my chart based on a cell reference.
Here is my code.
Private Sub Worksheet_calculate()
With ActiveChart.Axes(xlValue)
.MinimumScale = Worksheets("Chart Data").Range("E111").Value
End With
End Sub
Upvotes: 0
Views: 9919
Reputation: 12497
I'd do it this way:
Private Sub Worksheet_calculate()
Dim cht As Chart
Set cht = Worksheets("Chart").ChartObjects("Chart 1").Chart
cht.Axes(xlValue).MinimumScale = Worksheets("Chart Data").Range("E111").Value
End Sub
ActiveChart
ChartObjects("Chart 1")
with the name of
your chartChartObjects(1)
Upvotes: 3