Naming Chart

  • Thread starter Thread starter Randal W. Hozeski
  • Start date Start date
R

Randal W. Hozeski

I used to use the following code to activate a chart called
"LoadGraph"

ActiveSheet.ChartObjects("LoadGraph").Activate
ActiveChart.ChartArea.Select

What I can not figure out is. How I gave it the name?

It was useful when wanting to edit an existing chart to change
it's options and layout.

Another question would be.... at what point in the chart creation
can I give it the name? By default Excel uses Chart Area, but I
can not get it to activate the chart.

-Randy-
 
The only thing that I saw that was possible to name your chart, was.. After creating the chart, either programmatically with VBA, or by hand, that you went into the VBA editor and gave the chart object a name. Like the following

I created a chart on Sheet1
Then in the immediate window, I typed the following
Sheet1.ChartObject(1).Name = "ThisChart

Now, anytime I referenced Sheet1.ChartObject("ThisChart") I got the response(s) I expected when dealing with a Chart Object

Of course I would have to save the file for this renaming to remain, but that's up to you. :) I have no need for it

Does that make sense

If you created the chart using VBA code, you could or could have created the chart and given it a name at that time, and could continue to use that chart by name in the future.
 
Hey, thanks for the try but that did not
work for me. I tried placing it in a number
of places in the code that creates and adjusts
the chart and the code stops there each time.

I have tried the following as well with the
same results:

Selection.Name = "MyChartNameForRecall"

Any other suggestion? -Randy-
 
Back
Top