Hi,
I am using VBA to automatically update the Y-axis minimum and maximum based on a value in my excel sheet. However, this value is determined by a formula (lowest value in the dataset - 10%).
If I get rid of the formula in this cell and just have a value in there, it works fine using this code:
If Target.Address = "$F$2" Then
ActiveSheet.ChartObjects("Grafiek 7").Chart.Axes(xlValue).MinimumScale = Range("F2").Value
End If
If Target.Address = "$G$2" Then
ActiveSheet.ChartObjects("Grafiek 7").Chart.Axes(xlValue).MaximumScale = Range("G2").Value
End If
Where F2 is the value that has the minimum for the Y axis and G2 the maximum.
The actual minimum and maximum are:
Minimum: H2-(H2*0,1)
Maximum: I2+(I2*0,1)
Can someone help me to get VBA to recognise the value from a formula and use this to set the minimum and maximum values of the Y axis?
Thanks!
I am using VBA to automatically update the Y-axis minimum and maximum based on a value in my excel sheet. However, this value is determined by a formula (lowest value in the dataset - 10%).
If I get rid of the formula in this cell and just have a value in there, it works fine using this code:
If Target.Address = "$F$2" Then
ActiveSheet.ChartObjects("Grafiek 7").Chart.Axes(xlValue).MinimumScale = Range("F2").Value
End If
If Target.Address = "$G$2" Then
ActiveSheet.ChartObjects("Grafiek 7").Chart.Axes(xlValue).MaximumScale = Range("G2").Value
End If
Where F2 is the value that has the minimum for the Y axis and G2 the maximum.
The actual minimum and maximum are:
Minimum: H2-(H2*0,1)
Maximum: I2+(I2*0,1)
Can someone help me to get VBA to recognise the value from a formula and use this to set the minimum and maximum values of the Y axis?
Thanks!