Hello
im trying to get the code that was posted above to work with the chart in the attached workbook. hoping that to copy the sheet and maintain the chart dynamic references you can just click the "copy sheet" button.Cyanidation Template - 2012.xlsm
the below is code posted by someone else on this forum, i cant get it to work with my sheet.. may be due to the chart not being named the same but im not sure??
Can anyone help?
Sub CopyMaster()
Dim chtMaster As Chart
Dim objSeries As Series
Dim lngIndex As Long
Dim objCopy As Object
Set chtMaster = Worksheets("Master").ChartObjects(1).Chart
lngIndex = 0
With ActiveWorkbook
.Worksheets("Master").Copy after:=.Sheets(.Sheets.Count)
Set objCopy = .Sheets(.Sheets.Count)
End With
For Each objSeries In objCopy.ChartObjects(1).Chart.SeriesCollection
lngIndex = lngIndex + 1
objSeries.Formula = Replace(chtMaster.SeriesCollection(lngIndex).Formula, "Master", "'" & objCopy.Name & "'")
Next
End Sub
Bookmarks