I have a single xy scatter chart in which I want to control the max, min, and unit of the x and y axis. I am new to VBA and so far have gotten the y axis (price), but not the x axis (date) to work, when added later. I appreciate your help.
Sub ChangeChartScales()
Dim objCht As ChartObject
For Each objCht In ActiveSheet.ChartObjects
With objCht.Chart
With .Axes(xlValue)
.MinimumScale = ActiveSheet.Range("DC_yMin").Value
.MaximumScale = ActiveSheet.Range("DC_yMax").Value
.MajorUnit = ActiveSheet.Range("DC_yUnit").Value
End With
With .Axes(xlCategory)
.MinimumScale = ActiveSheet.Range("DC_xMin").Value
.MaximumScale = ActiveSheet.Range("DC_xMax").Value
.MajorUnit = ActiveSheet.Range("DC_xUnit").Value
End With
End With
Next objCht
End Sub
Bookmarks