Can't Find/Replace on charts?

  • Thread starter Thread starter Jamie Martin
  • Start date Start date
J

Jamie Martin

I have decided that in my chart titles, "Fall" should always be capitalized.
I have a group of 20 or 30 charts I need to standardize. I was going to try
to write some VBA code to do this, and I started by turning on the Macro
Recorder and doing Find/Replace. But Find/Replace is greyed out when I'm on
a chart sheet. What gives? Is there a way to do a Find/Replace anyway with
VBA? (Perhaps I should ask the VBA newsgroup?)

Thanks for your help,

Jamie
 
Jamie -

You could use a procedure like this:

Sub ChangeChartTitles()
Dim Cht as Chart
Dim Str1 as String
Dim Str2 as String
Str1 = "fall"
Str2 = "Fall"
For Each Cht in ActiveWorkbook.Charts
Cht.ChartTitle.Text = _
WorksheetFunction.Substitute(Cht.ChartTitle.Text, Str1, Str2)
Next
End Sub

- Jon
 
I imagine it should be possible to write a VBA macro to do a replace
for chart entities. However, a general purpose utility would have to
have a rather extensive capability set and very limited application.

Since you have what appears to be a one-time requirement, it should be
a lot faster to do it by hand.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Back
Top