Hi,
I have written some VBA code (Excel 2003) that copies the 2nd worksheet containing 3 charts and updates them with data on the 1st worksheet. This iterative process works fine if less than 26 graphs are created, at which point it falls over. This issue is recognised by Microsoft, and they suggest adding a new sheet using an external template to avoid this problem. However this gives run time error 2147221080.... The section of code is as follows:
If sheet_num > 2 Then
'Sheets(sheet_num - 1).Select
'Sheets(sheet_num - 1).Copy After:=Worksheets(Worksheets.Count)
Sheets.Add Type:=total_path & "\Q60 Graphs Template.xls", After:=Worksheets(Worksheets.Count)
Sheets(sheet_num).Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
The commented out lines (2 & 3) are the old code that works fine for 26 iterations. Line 4 is the new code. The error occurs on the final line: ActiveChart.PlotArea.Select
It appears to me that whilst "Chart 1" is being activated, it is not being recognised as the active chart ??
Any suggestions gratefully received.......
I have written some VBA code (Excel 2003) that copies the 2nd worksheet containing 3 charts and updates them with data on the 1st worksheet. This iterative process works fine if less than 26 graphs are created, at which point it falls over. This issue is recognised by Microsoft, and they suggest adding a new sheet using an external template to avoid this problem. However this gives run time error 2147221080.... The section of code is as follows:
If sheet_num > 2 Then
'Sheets(sheet_num - 1).Select
'Sheets(sheet_num - 1).Copy After:=Worksheets(Worksheets.Count)
Sheets.Add Type:=total_path & "\Q60 Graphs Template.xls", After:=Worksheets(Worksheets.Count)
Sheets(sheet_num).Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
The commented out lines (2 & 3) are the old code that works fine for 26 iterations. Line 4 is the new code. The error occurs on the final line: ActiveChart.PlotArea.Select
It appears to me that whilst "Chart 1" is being activated, it is not being recognised as the active chart ??
Any suggestions gratefully received.......