Chart Y Axis Scale Greater Than 100%

WallyBackman

New Member
Joined
Apr 8, 2007
Messages
21
Fantastic site!

I have multiple workbooks, each with multiple column charts in Excel 2003, showing a maximum of 120% even though none of the source figures are more than 100%. The source data for the chart comes from monthly percentages below the chart.

Please help with some code to look in each chart in the active workbook and if the Max Y Axis scale is greater than 1, change it to 1.

Thanks for your time.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try

Code:
Sub xtest()
Dim ws As Worksheet, ch As ChartObject
For Each ws In ActiveWorkbook.Worksheets
    For Each ch In ws.ChartObjects
        ch.Chart.Axes(xlValue).MaximumScale = 1
    Next ch
Next ws
End Sub
 
Upvote 0
VoG,

Thanks for the quick reply.

The code worked to change the Max for all of the charts, but I only want to change the Max for those charts that exceed 100%.
 
Upvote 0
Try

Code:
Sub xtest()
Dim ws As Worksheet, ch As ChartObject
For Each ws In ActiveWorkbook.Worksheets
    For Each ch In ws.ChartObjects
        If ch.Chart.Axes(xlValue).MaximumScale > 1 Then ch.Chart.Axes(xlValue).MaximumScale = 1
    Next ch
Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,399
Messages
6,184,751
Members
453,254
Latest member
topeb

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