Chart series link to tab name

likelyladmatty

New Member
Joined
May 24, 2012
Messages
1
Hi there

I have a template tab with charts linked to data within that tab, the data is dynamic to a single cell within the tab and this cell is linked to the tab name. I have copied the whole sheet to over 200 sheets each with their own dynamic tab name. However I have now just realized that the charts are all still linked to the original tab data. I need to be able to make these charts dynamic to the tab they sit in. Is there a way to make 'Sheet1' in the example below dynamic to the tab name for example by using the formula: =RIGHT(CELL("Filename",A1),LEN(CELL("Filename",A1))-FIND("]",CELL("Filename",A1)))

e.g. =SERIES('Sheet1'!$R$8,'Sheet1'!$S$6:$T$7,'Sheet1'!$S$8:$T$8,1)

Any help would be great!

Matty
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi Matty,

You can run this macro. It will change the "Sheet1" in the series formula to the TabNames in which charts are located.
Please make a back up file before running this macro

Code:
Sub ChangeChartSeries()
Dim mychart As Chart, i As Integer, j As Integer, k As Integer
For i = 2 To Sheets.Count
    For j = 1 To Sheets(i).ChartObjects.Count
        Set mychart = Sheets(i).ChartObjects(j).Chart
        For k = 1 To mychart.SeriesCollection.Count
            mychart.SeriesCollection(k).Formula = Replace(mychart.SeriesCollection(k).Formula, "Sheet1", Sheets(i).Name)
        Next k
    Next j
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top