View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default Changing Chart Parameters

The following changes the scaling of a specified chart without selecting
either the worksheet or chart:

Sub SetAxesValues()
Dim cMin As Long, cMax As Long
Dim cht As Chart

cMax = ws.Range("A3").Value
cMin = ws.Range("A4").Value
Set cht = ws.ChartObjects("PotElectRoll").Chart

With cht.Axes(xlValue)
.MinimumScale = cMin
.MaximumScale = cMax
.MinorUnit = (cMax - cMin) / 25
.MajorUnit = (cMax - cMin) / 5
End With

cMin = ws.Range("A5").Value
cMax = ws.Range("A6").Value

With cht.Axes(xlCategory)
.MinimumScale = cMin
.MaximumScale = cMax
End With
End Sub

Regards,
Greg