I'm currently using the following code to update an Excel Charts X Axis scale.
Application.ScreenUpdating = False
.MinimumScale = Application.Sheets("Schedule").Range("D8") - "5"
.MaximumScale = Application.Sheets("Schedule").Range("F24") + "5"
.MinorUnit = 1
.MajorUnit = 7
.Crosses = xlCustom
.CrossesAt = Application.Sheets("Schedule").Range("D8") - "5"
.ReversePlotOrder = False
.ScaleType = xlLinear
This works great with the chart as a sheet within the workbook. The problem now is that due to additional data requirements I've had to place the chart in the Schedule Sheet and then had to superimpose 2 additional charts over top with the same scaling that show updated information.
I can get the chart numbers ie. ActiveSheet.ChartObjects("Chart 1082").Activate. But because I'm using a template each time a new workbook is created the chart numbers change.
Ok to cut to the chase - I need a way to return the numbers of the ChartObjects in the Activesheet so that I can loop through them and apply the scaling shown above to the X Axis of each.
I know it's possible but just can get my head around it.
Dim ch As ChartObject
Set ch = Worksheets("Schedule").ChartObjects.????????
Then something with - for each ch in worksheet ??