Thread: Scaling Charts
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
B Lynn B B Lynn B is offline
external usenet poster
 
Posts: 131
Default Scaling Charts

To be sure your code runs every time A3 changes:

If Not Intersect(Target, Range("A3")) Is Nothing Then
With ActiveSheet.ChartObjects("Chart 1").Chart.Axes(xlValue)
.MinimumScale = Range("S3").Value
End With
End If

Also, unless you have a control in place to ensure S3 has a valid numeric
value, you should probably include some form of error handling.


"KatieW" wrote:

I am trying to get the mininmum value of my Y axis to link to a cell with in
my worksheet. I want the other axis settings to remain on auto. I want the
minimum value to equal sell $S$3 everytime Cell $A$3 changes. Below is what
I have so far, but this doesn't work. When I run the code the End Sub is lit
up.

Private Sub Worksheet_Change(ByVal Target As Range)

Select Case Target.Address = "$A$3"
Case Range("$S$3")
With ActiveSheet.ChartObjects("Chart 1").Chart.Axes(xlValue)
.MinimumScale = "$S$3"
End With
End Sub