G
Guest
I have created a macro in a workbook that is being used and run by other
people. Each person is naming their workbook something unique.
Unfortunately, that seems to cause problems for the macro. They receive a
run-time error 'subscript out of range'. The code were it is breaking is as
follows:
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(2).Values = "=Formulas!R11C2"
ActiveWindow.Visible = False
Windows("Savings for Single Country Reporting.xls").Activate
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(2).Values = "=Formulas!R17C2"
ActiveWindow.Visible = False
Windows("Savings for Single Country Reporting.xls").Activate
ActiveCell.Select
This is where the code breaks:
Windows("Savings for Single Country Reporting.xls").Activate
The workbook was renamed by it's new owner to 'LA Draft'. Several other
workbooks were also renamed to different names.
people. Each person is naming their workbook something unique.
Unfortunately, that seems to cause problems for the macro. They receive a
run-time error 'subscript out of range'. The code were it is breaking is as
follows:
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(2).Values = "=Formulas!R11C2"
ActiveWindow.Visible = False
Windows("Savings for Single Country Reporting.xls").Activate
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(2).Values = "=Formulas!R17C2"
ActiveWindow.Visible = False
Windows("Savings for Single Country Reporting.xls").Activate
ActiveCell.Select
This is where the code breaks:
Windows("Savings for Single Country Reporting.xls").Activate
The workbook was renamed by it's new owner to 'LA Draft'. Several other
workbooks were also renamed to different names.