I'm trying to use a For loop to copy/paste named charts with the same name as the reference cell and the function below returns the correct chart but is just copy/pasting the chart in question 36 times (the number of worksheets in my document). Am I using the wrong function to begin with?
Dim aChar As ChartObject 'these lines define the name of the chart
Dim aFlag As Boolean
Dim aCharName As String
On Error Resume Next
Application.ScreenUpdating = False
aCharName = (Sheets("Sheet1").Range("A1"))
aFlag = False
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets 'The For Loop: I think this is where the problem is
If aChar.Name = aCharName Then
ws.ChartObjects(Sheets("Sheet1").Range("A1")).Activate
ActiveChart.ChartArea.Copy 'from now on the simple copy/paste
Sheets("Sheet1").Select
Range("A2").Select
ActiveSheet.Pictures.Paste
End If
Next
many thanks