Change Excel Sunburst Chart Data Label Font Size with VBA
Question details
Change the font size of individual Sunburst chart data labels using VBA.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants a VBA macro to format specific labels in an Excel Sunburst chart.
- Observed behavior
- The macro may appear to change a label's font size without applying it, affect the whole label series, or encounter an error when a label is hidden.
Check the chart name in Excel and identify the data label indexes you want to format. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) and enable macros only if you trust the file.
Set individual data label font sizes with VBA
Use FullSeriesCollection and TextFrame2 to format specific labels in the Sunburst chart.
In Excel, open the worksheet containing the chart and press Alt+F11. In the VBA editor, choose Insert > Module.
Paste the following code into the module: Sub SetSunburstLabelSize() Dim chartObject As ChartObject Set chartObject = ActiveSheet.ChartObjects("Chart 1") chartObject.Chart.FullSeriesCollection(1).DataLabels(1).Format.TextFrame2.TextRange.Font.Size = 20 chartObject.Chart.FullSeriesCollection(1).DataLabels(6).Format.TextFrame2.TextRange.Font.Size = 20 chartObject.Chart.FullSeriesCollection(1).DataLabels(7).Format.TextFrame2.TextRange.Font.Size = 20 End Sub
Replace "Chart 1" with your chart's name, change the label indexes and font size as needed, and press F5 while the cursor is inside the macro. Return to the worksheet to check the labels.

Enable Equalize character height before running the macro
Try this workaround if VBA font-size changes do not display as expected or affect the entire label series.
Work with spreadsheet charts in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility, making it easy to move everyday spreadsheet work to WPS. It does not fix Excel's VBA or Sunburst label-formatting behavior.

Frequently Asked Questions
How do I change the font size of a different data label?
In the VBA macro, replace the number in DataLabels(1) with the desired label index and set Font.Size to the size you want. Run the macro again from the VBA editor.
Why does the macro produce an error for a data label?
Excel may automatically hide a Sunburst label, making it inaccessible to the macro. Check the chart for hidden labels and test the indexes of labels that are visible.
Why are all my Sunburst labels changing size?
Some Excel versions can apply an individual label's formatting to the series. Try right-clicking the data labels, choosing Font, and enabling Equalize character height before running the macro again.
Can WPS Office fix this Excel VBA issue?
No. The issue concerns Excel's chart and VBA behavior. WPS Office is an alternative for compatible spreadsheet work, but it does not repair the Excel-specific problem.




