I'm creating a simple little macro that draws a chart from some data in Excel. The frustration comes because every time my macro draws a chart, it sequences the number. The first chart is "chart 1" the second is "chart 2" even if "chart 1" no longer exists.
I know there's a simple answer to this problem but I can't find it, hence the frustration. Please could someone tell me how to take charge of the chart identification before I chew another corner off my keyboard!
Jump to Post
How are you adding the chart? If you are using the Charts.Add method then you can use this to get a reference to the new chart object.
dim chartNew as Chart set chartNew=ActiveWorkBook.Charts.Add chartNew.ChartTitle.Characters.Text = "This is a New Chart"
And so on.
By the way …
All 4 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.