I have a macro that copies a chart and its associated data worksheet to a new workbook. In order to remove the charts external references to the original workbook, the macro attempts to edit these references. Since the series used may vary from one instance to the next, I am looping through the series and trying to retrieve the names of them. The code (simplified) looks like this...
nseries=ActiveChart.SeriesCollection.Count
for i=1 to nseries
sname=ActiveChart.SeriesCollection(i).name
' code to reset name, values and Xvalues
next
This appears to work for all of the series except one. It doesn't appear to matter in what order I put the series, it is always the same one that causes an error.
Does anyone have any ideas on this?
Many thanks,
Martin
Edited... No reply necessary. Problem was that despite the data range being specified for the offending series, if the cells referenced are empty, the series name cannot be recovered. The problem was solved by temporarily putting in a dummy data pair and deleting it after the name was recovered. Another Excel 'feature'
Bookmarks