formatting text within multiple graphs

M

matlocktm

Hello,

I have a spreadsheet with over 100 graphs which need to have the text
formatting changed. I could select each category axis, value axis,
legend, and chart title individually, and within each graph to apply
the changes, however, I'm sure it would take forever. Is there a smart
way to accomplish the above-mentioned task?

Any help is greatly appreciated.

Best regards,

T. Matlock
 
J

Jon Peltier

Using VBA, you could do a For Each Chart in ActiveWorkbook.Charts, plus
a For Each Sheet in ActiveWorkbook.Sheets/For Each ChartObject in
Sheet.ChartObjects to loop through all the charts and format the
individual text elements, while you go get coffee.

Sub FixAllCharts
For Each myChart in ActiveWorkbook.Charts
Call FormatText(myChart)
Next
For Each mySheet in ActiveWorkbook.Sheets
For Each myChtOb in mySheet.ChartObjects
Call FormatText(myChtOb.Chart)
Next
Next
End Sub

Sub FormatText(theChart as Chart)
With theChart
If .HasTitle then
With .ChartTitle.Font
.Size = 50
.Bold = True
' etc.
End With
End If
' same for axis tick labels and axis titles, data labels, text boxes
End With
End Sub

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

Jon Peltier

This works if you do it in code, setting a single font attribute. If you
do it manually, using the formatting command bar or the format font
dialog, all attributes will be changed. If all you want to do is change
the font size to 12, but keep some items bold and others not bold, the
F4 trick won't help, because it will remember the bold setting of the
last thing you changed.

It takes a little longer to set up the macro, but you can assign
different sizes and styles to different font elements within the charts.

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