how to set a variable to a Chart? not ChartObject

G

Guest

Sheet1 contains "Chart 1"

I want to set a variable to "Chart 1"

Dim chrt As Chart
Set chrt = Sheets("Sheet1").ChartObjects("Chart 1")

This gives a type mismatch error. If I Dim chrt As ChartObject then I do
not get the chart methods/properties in the dropdown. But I don't see any
other options for setting chrt to "Chart 1". Any suggestions appreciated.

Thanks,
Rich
 
R

Rob Bovey

Rich said:
I want to set a variable to "Chart 1"

Dim chrt As Chart
Set chrt = Sheets("Sheet1").ChartObjects("Chart 1")

This gives a type mismatch error. If I Dim chrt As ChartObject then I do
not get the chart methods/properties in the dropdown. But I don't see any
other options for setting chrt to "Chart 1". Any suggestions appreciated.

Hi Rich,

This is how to get at the underlying Chart contained in a ChartObject:

Set chrt = Sheets("Sheet1").ChartObjects("Chart 1").Chart

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top