How do I loop through workbook and rename all chart titles?

  • Thread starter Thread starter Backpaddler
  • Start date Start date
B

Backpaddler

I have a workbook with about 45 worksheets, each of which have 2
charts. When the workbook is opened I get a 4 character code from th
user via an InputBox. I'd like to take this code and prefix ever
chart title in the workbook with it.

Could someone post an example of the VBA code that I'd use t
dynamically loop through every worksheet/chart and append this to th
existing chart titles?

Thanks a lot. I'm familiar with VB but not familiar enough with Exce
objects to get this done in time.

BackPaddle
 
Here is the quick and dirty solution. I'm sure you can clean this up
bit, though. - Pikus

p = "PREF"
sheetCount = 45
For x = 1 To sheetCount
With Worksheets(x)
c = .ChartObjects.Count
For y = 1 To c
.ChartObjects(y).Chart.ChartTitle.Text = _
p & .ChartObjects(y).Chart.ChartTitle.Text
Next y
End With
Next
 
Back
Top