View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Adjusting Y axis scale of a chart using a scrollbar?


Hi Brad,

I don't know how to insert scroll bars or if it is even possible. However,
you could use a couple of cells on the worksheet containing the chart and set
the Maximum and Minimum values to use for the y axis and place the code in a
worksheet change event so that when you change either value the axis of the
chart will reflect the change something like the following.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim isect
Set isect = Application.Intersect(Target, Range("D1:E1"))
If Not isect Is Nothing Then
With Sheets("Sheet1").ChartObjects("Chart 1").Chart
With .Axes(xlValue, xlPrimary)
.MaximumScale = Sheets("Sheet1").Range("D1")
.MinimumScale = Sheets("Sheet1").Range("E1")
End With
End With
End If
End Sub

--
Regards,

OssieMac