B
Barb Reinhardt
I have a workbook with about 15 worksheets. On each worksheet is typically
one chart ... unfortunately, the chart name is not always Chart 1. I have
this code.
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
'If sht.ProtectContents = True Then
'sht.Unprotect Password:=""
'End If
'Worksheets(sht).Activate
chartcount = ActiveSheet.ChartObjects.Count
Debug.Print chartcount
If chartcount > 0 Then
For j = 1 To chartcount
ActiveSheet.ChartObjects("Chart " & j).Activate
'Worksheets(sht).ChartObjects(cht).Activate
seriescount = ActiveChart.SeriesCollection.Count
For k = 1 To seriescount
SeriesFormula = ActiveChart.SeriesCollection(k).Formula
Debug.Print sh; j; xval, yval; SeriesFormula
Next k
'Next cht
Next j
End If
'Debug.Print sh; chartcount
Next sht
WHICH works if the chart name starts at chart 1 on the sheet and increments
by one. It doesn't work if the chart name is CHART 9. What do I need to
change to get it to select the chart name that is in the sheet?
one chart ... unfortunately, the chart name is not always Chart 1. I have
this code.
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
'If sht.ProtectContents = True Then
'sht.Unprotect Password:=""
'End If
'Worksheets(sht).Activate
chartcount = ActiveSheet.ChartObjects.Count
Debug.Print chartcount
If chartcount > 0 Then
For j = 1 To chartcount
ActiveSheet.ChartObjects("Chart " & j).Activate
'Worksheets(sht).ChartObjects(cht).Activate
seriescount = ActiveChart.SeriesCollection.Count
For k = 1 To seriescount
SeriesFormula = ActiveChart.SeriesCollection(k).Formula
Debug.Print sh; j; xval, yval; SeriesFormula
Next k
'Next cht
Next j
End If
'Debug.Print sh; chartcount
Next sht
WHICH works if the chart name starts at chart 1 on the sheet and increments
by one. It doesn't work if the chart name is CHART 9. What do I need to
change to get it to select the chart name that is in the sheet?