Looping through to stop on pie charts

  • Thread starter Thread starter Daniel Bonallack
  • Start date Start date
D

Daniel Bonallack

Could someone please tell me how to loop through a
workbook and make the font of pie charts 8pt (and only
pie charts)?

Thanks in advance

Daniel
 
Daniel -

Your macro should look like this:

Sub PieChartFonts8pt()
Dim sh As Object
Dim ch As Chart
Dim cho As ChartObject

' Get Chart Sheets
For Each ch In ActiveWorkbook.Charts
Select Case ch.ChartType
Case xlPie, xlPieExploded, xl3DPie, xl3DPieExploded
ch.ChartArea.Font.Size = 8
End Select
Next

' Get Embedded Charts
For Each sh In ActiveWorkbook.Sheets
For Each cho In sh.ChartObjects
Select Case cho.Chart.ChartType
Case xlPie, xlPieExploded, xl3DPie, xl3DPieExploded
cho.Chart.ChartArea.Font.Size = 8
End Select
Next
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top