I think "AciveSheet" is highlighted, right?
Try:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.ChartObjects("Chart12").Activate
ActiveChart.Axes(xlValue, xlPrimary).MaximumScale = _
Application.Ceiling(ActiveSheet.Range("Y3").Value, 0.05)
End Sub
Or just
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.ChartObjects("Chart12").Chart.Axes( _
xlValue, xlPrimary).MaximumScale = _
Application.Ceiling(ActiveSheet.Range("Y3").Value, 0.05)
End Sub
Which won't activate your chart...
In article ,
Phil Hageman wrote:
Jon,
I ran the macro recorder as you suggest at your website, and added your
lines too, but get the following: Compile error: Variable not defined. The
Private Sub line is highlighted yellow, and €śActiveSheet€ť is blue highlighted
at the beginning of the second line. Can you help me straighten this out?
Appreciate your help.
Phil
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
AciveSheet.ChartObjects("Chart 12").Active
With ActiveChart.Axes(xlValue, xlPrimary)
.MaximumScale = ActiveSheet.Range("Y3", 0.05)
End With
End Sub
"Jon Peltier" wrote:
Hi Phil -
Use the approach I describe he
http://peltiertech.com/Excel/Charts/...nkToSheet.html
but link to CEIL(Y3,0.05) instead of Y3.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
Phil Hageman wrote:
I have a chart on a worksheet and want to make the Y scale maximum value
equal the value of cell Y3 (this is a merged cell range Y3:Y5), rounded
up to
the next €ś5€ť increment. For example, 101% in merged cell Y5 would be
105% in
the chart Y scale maximum. How would I do this?