Sub AutoScale_Off did not work

kellon22

New Member
Joined
Dec 17, 2004
Messages
9
I ran the following code from the microsoft solution page to no avail. The Message box indicated that 149 charts were altered, but the infamous "no new fonts may be applied" message came up first thing on attempt to work in the file. The problem continued in much the same way a couple days previous when I applied John Peltier's code solution; though, that was my first experience applying VBA code, and I might have interposed some erroneous mouse clicks. Anyway, is 149 charts beyond fixing with this sort of VBA solution? How can I fix disable autoscaling in the file, and then continue to build and use the file?

Thank you for any suggestions.

Sub AutoScale_Off()
Dim ws As Worksheet, co As ChartObject, i As Integer
Dim ch As Chart
For Each ws In ActiveWorkbook.Worksheets

' Go through each worksheet in the workbook

For Each co In ws.ChartObjects

'In each chart turn the Auto Scale font feature off

i = i + 1
co.Chart.ChartArea.AutoScaleFont = False
Next co
Next ws

For Each ch In ActiveWorkbook.Charts

'Go through each chart in the workbook

ch.ChartArea.AutoScaleFont = False
i = i + 1
Next
MsgBox i & " charts have been altered"
Application.DisplayAlerts = True
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,225,071
Messages
6,182,685
Members
453,132
Latest member
nsnodgrass73

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