VBA & Macro Problems

Change Font Size in All PowerPoint Charts with VBA

Steven ParkerSteven Parker Nov 14, 2026 868 views

Question details

The user needs to change chart text or data-label font sizes throughout a PowerPoint presentation using VBA.

Change Font Size in All PowerPoint Charts with VBA
Product
Microsoft PowerPoint
Device & OS
not provided
Scenario
A presentation contains charts across multiple slides, and the user wants to apply a consistent font size.
Observed behavior
The desired result is a consistent font size for chart elements and, where needed, separately added text boxes.
Before you start

Open the presentation in a desktop version of PowerPoint that supports VBA, and save it as a macro-enabled PowerPoint Presentation (.pptm) if you want to retain the macro. Check whether the text to update is part of a chart or a separate slide text box.

Solution 1Recommended

Run a VBA macro to resize chart-area text and data labels

Use this macro to process top-level charts on every slide and set their chart-area and series data-label font sizes.

Chart-area formatting may not override every individually formatted chart element. The macro skips unsupported chart properties without stopping, so inspect the results after it runs.

1
Open the VBA editor

In PowerPoint, open the presentation and select Developer > Visual Basic. If the Developer tab is hidden, enable it in PowerPoint's ribbon settings.

2
Insert the macro

In the VBA editor, select Insert > Module and paste this code: Sub SetChartFonts() Dim slideObj As Slide Dim shapeObj As Shape Dim seriesIndex As Long Dim seriesCount As Long Const fontSize As Single = 12 For Each slideObj In ActivePresentation.Slides For Each shapeObj In slideObj.Shapes If shapeObj.HasChart Then On Error Resume Next shapeObj.Chart.ChartArea.Format.TextFrame2.TextRange.Font.Size = fontSize seriesCount = 0 seriesCount = shapeObj.Chart.SeriesCollection.Count For seriesIndex = 1 To seriesCount If shapeObj.Chart.SeriesCollection(seriesIndex).HasDataLabels Then shapeObj.Chart.SeriesCollection(seriesIndex).DataLabels.Format.TextFrame2.TextRange.Font.Size = fontSize End If Next seriesIndex On Error GoTo 0 End If Next shapeObj Next slideObj End Sub

3
Set the size and run

Change the value of fontSize in the module if needed. Place the cursor inside SetChartFonts and select Run > Run Sub/UserForm.

4
Inspect the charts

Return to the slides and check chart text and data labels. If an element remains unchanged, select it in the chart and use Home > Font Size to adjust it, or adapt the macro to target that element.

Scope of the macro: This loop checks shapes directly on each slide, not charts inside groups. It also does not process separate text boxes or guarantee changes to individually formatted labels.
Free Microsoft Office alternative

Edit presentations with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for opening and editing PowerPoint presentations. Its format compatibility makes it easy to move existing files into your workflow; it does not fix PowerPoint's VBA behavior.

Edit presentation text and charts in a familiar slide interfaceOpen and edit Microsoft PowerPoint PPT and PPTX filesMove existing presentations into a lightweight office suiteUse the free version for everyday presentation work
microsoft office alternative - wps office

Frequently Asked Questions

Why did the chart-area macro run without changing the text?

Chart-area formatting may not override individually formatted elements. Select the unchanged title, label, or legend in the chart and adjust it through Home > Font Size, or modify the VBA to target that element directly.

How can I change the font size used by the macro?

Open Developer > Visual Basic and change the number in Const fontSize As Single = 12 to the size you want, then run the macro again.

Will the chart macro also resize text boxes placed on a slide?

No. Standalone slide text boxes are separate shapes. Use the text-box macro if you want to resize all top-level text boxes, including those unrelated to charts.

How do I keep the macro in the presentation?

Use File > Save As and choose PowerPoint Macro-Enabled Presentation (.pptm). A standard .pptx file does not retain VBA macros.