View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Duplicate chart on new sheets

What was printed to the Immediate Window?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Robert H" wrote in message
oups.com...
Not being able to figure out the errors and searching around, I came
up with this:

Sub MyChangeSeriesFormula()
Dim chrt As ChartObject
Dim ser As Series
Dim formulaStr 'As String
Dim oldNm As String
Dim newNm As String

oldNm = "Template"
newNm = ActiveSheet.Name

For Each chrt In ActiveSheet.ChartObjects
Debug.Print "chrt = " & chrt.Index
For Each ser In chrt.Chart.SeriesCollection
Debug.Print "ser.FormulaOld = " & ser.Formula
formulaStr = ser.Formula
formulaStr = Replace(formulaStr, oldNm, newNm)
Debug.Print "ser.FormulaNew = " & ser.Formula

Next ser

Next chrt

End Sub

No errors but "template" does not get replaced!!!!!!!!!!!!!!!! I
created a second very simple chart, copied it to the sheet and ran the
code just to make sure the complexity of the series was not a
problems. I ran into the same problem on the second chart.