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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,215,486
Messages
6,125,070
Members
449,205
Latest member
Healthydogs

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