Bulk insert of chart titles?

  • Thread starter SouthAfricanStan
  • Start date
S

SouthAfricanStan

I have several worksheets in a workbook, the layout on each worksheet is the
same as the others, and each sheet has a chart, displaying charts of the
data in each worksheet.
I am able to insert chart titles into each chart, one at a time, but would
like to do this as a single operation, in other words is there any way that
I can insert a title in each chart referencing the same cell in each
worksheet, in one operation?
 
J

Jon Peltier

Stan -

You need a little macro to do what you want. This loops through every
worksheet in the active workbook, and for every chart on the worksheet, it
adds a title that is linked to cell A1 of that worksheet.

Sub InsertChartTitles()
Dim chtob As ChartObject
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each chtob In ws.ChartObjects
With chtob.Chart
.HasTitle = True
.ChartTitle.Text = "=Sheet1!R1C1"
End With
Next
Next
End Sub

- Jon
 

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

Top