While generating a chart from some Excel data I get a run-time error "The Item with the specified name wasn't found".
This line of code is highlighted in debug:
ActiveSheet.Shapes("Chart 2").IncrementLeft -3
I need to be able to force the created chart to be named a specific name each time so whenever I run the macro it will always work. I had this issue when my first macro created a new sheet after formatting the text data. I solved that by forcing the new sheet to always be named Sheet2 by adding this line of code in and the macro works great:
ActiveSheet.Name = "Sheet2"
I can't get this working for the chart though.
I have tried:
ActiveChart.Name = "Chart 2"
ActiveChart.Parent.Name = "Chart 2" (even though this is not an embedded chart)
What can I add to the code just before the
ActiveSheet.Shapes("Chart 2").IncrementLeft -3 line
to get past the chart naming issue?
Thanks all,
Don
This line of code is highlighted in debug:
ActiveSheet.Shapes("Chart 2").IncrementLeft -3
I need to be able to force the created chart to be named a specific name each time so whenever I run the macro it will always work. I had this issue when my first macro created a new sheet after formatting the text data. I solved that by forcing the new sheet to always be named Sheet2 by adding this line of code in and the macro works great:
ActiveSheet.Name = "Sheet2"
I can't get this working for the chart though.
I have tried:
ActiveChart.Name = "Chart 2"
ActiveChart.Parent.Name = "Chart 2" (even though this is not an embedded chart)
What can I add to the code just before the
ActiveSheet.Shapes("Chart 2").IncrementLeft -3 line
to get past the chart naming issue?
Thanks all,
Don