Without wanting to sound totally stupid, how would I set calculation to manual (or is that what you meant by stepping through the code...) I'm really not so familiar with VBA, I tried stepping through the code but not really sure what I'm looking for to be totally honest.
The code is basically supposed to change the data source for the charts from the name of the original workbook to the name of the new workbook but when I run it, I just get the hour glass and the main Workbook hangs (not responding). I'm unsure what is causing the problem though.
For Each ws In ActiveWorkbook.Worksheets
For Each oChart In ws.ChartObjects
For Each mySrs In oChart.Chart.SeriesCollection
mySrs.Formula = WorksheetFunction.Substitute(mySrs.Formula, "'Original Workbook Name.xlsm'", "'New Workbook Name.xlsx'")
Next
Next
Next ws
The error I get relates to the line in red and is a run-time error '1004', telling me to verify your formula contains a valid path, workbook, range name and cell reference.
My source series name is:
=SERIES(" Total Forecast",{"M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12"},'Original Workbook Name.xlsm'!My_Forecast,1)
and I'm trying to change it to:
=SERIES(" Total Forecast",{"M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12"},'New Workbook Name.xlsx'!My_Forecast,1)
Not sure if that helps to explain the problem?
Bookmarks