Help with Macro to Change Fonts

ttbuson

Board Regular
Joined
Nov 18, 2011
Messages
80
I have a macro that goes through each sheet and changes the worksheet font and the font on any graphs to be Arial. I have data labels on a couple of the graphs and some of them are bolded, italicized, or a different color. When I run the macro, it loses any formatting I had. Does anyone know how to deal with this issue? Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
This is the macro I'm using.

Code:
Sub ChangeFontArial()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Dim WS As Worksheet
Dim CH As ChartObject
For Each WS In ThisWorkbook.Worksheets
    WS.Cells.Font.Name = "Arial"
    For Each CH In WS.ChartObjects
        With CH.Chart.ChartArea
            .Font.Name = "Arial"
        End With
    Next CH
Next WS
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
 
Upvote 0
The ChartArea seems to include the DataLabels, although I don't think that it should. You will need to deal with the chart elements individually.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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