Sub ChangeChartAxis()You can edit the numbers accordingly or specify the sheet instead of using ActiveSheet
With ActiveSheet.ChartObjects("<<Chart Name>>").Chart.Axes(xlValue)
.MaximumScale = 5000
.MinimumScale = 0
.MajorUnit = 500
.MinorUnit = 100
End With
End Sub
e.g. Instead of modifying the chart in the activesheet, you might want to edit the chart in Sheet 2, so change ActiveSheet to Sheet2.
If you are using a Word Document, you can change it to ActiveDocument or some sort. As long as that line manages to select the chart, this VBA code should work
To find the chart name:
- Click on the chart you want to edit, you will notice that more tabs will appear with a "Chart Tools" header above.
- Click the layout tab in the chart tools ribbon
- You will see the chart name on the ride side of the ribbon in the "Properties" group
- A picture if you still don't understand where to find it! (click on it to zoom in)
No comments:
Post a Comment