cheveley
Active Member
- Joined
- Sep 24, 2002
- Messages
- 273
i have some code that adjusts the scale of a share price graph to the correct dollar scale depending on which company is selected. my problem is that the scaling code works fine, but i cant seem to get the code to automatically execute every time a new company is selected. a new company is selected by inputting the company ticker i.e. MSFT in a cell.
my code is as follows;
Public Sub UpdateChartScales()
Dim intMin As Variant
Dim intMax As Variant
'P and Q Axis Adj
Application.Goto Reference:="gmax"
intMax = ActiveCell.Value
Application.Goto Reference:="gmin"
intMin = ActiveCell.Value
Sheets("iWATCH").Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = intMin
.MaximumScale = intMax
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
End With
End Sub
thanks..........
my code is as follows;
Public Sub UpdateChartScales()
Dim intMin As Variant
Dim intMax As Variant
'P and Q Axis Adj
Application.Goto Reference:="gmax"
intMax = ActiveCell.Value
Application.Goto Reference:="gmin"
intMin = ActiveCell.Value
Sheets("iWATCH").Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = intMin
.MaximumScale = intMax
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
End With
End Sub
thanks..........