Changing axes on multiple charts in multiple sheets (VBA)

Mark_Hewitt

New Member
Joined
Mar 9, 2015
Messages
3
Hi folks.
I posted this before but got no replies so I’m simplifying to see if I get more luck. :confused:
I have 4 sheets (A,B,C,D) each with 4 charts (renamed Chart1, Chart2 etc)
I want to change the scales (in my code these will differ) but for this purpose can you let me know why this doesn’t work and what possible adjustments I could make?
Thanks
Mark





Dim Array_cnt, Cnt As Integer, Report_WB As Workbook, Report_WS As Worksheet, Sheet_names() As Variant

Sheet_names() = Array("A", "B", "C", "D")

For Array_cnt = 0 To 3
Set Report_WS = Report_WB.Worksheets(Sheet_names(Array_cnt))​
For Cnt = 1 To 4​
ActiveSheet.ChartObjects("Chart" & Cnt).Activate ' <-- This seems to halt the execution
ActiveChart.Axes(xlValue).MaximumScale = 100
ActiveChart.Axes(xlValue).MinimumScale = 0​
Next​
Next
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
can you SELECT the chart object

is it actually Chart1
 
Upvote 0
Yes mole999 - I renamed each chart to Chart1, Chart2 etc (Using Chart tools --> Layout --> Chart name (under properties). I did this intentionally so the loop should work for all 4 sheets.
M
 
Upvote 0

Forum statistics

Threads
1,223,637
Messages
6,173,488
Members
452,515
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top