Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default how to set a variable to a Chart? not ChartObject

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default how to set a variable to a Chart? not ChartObject

"Rich" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default how to set a variable to a Chart? not ChartObject

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

--
Regards,
Tom Ogilvy


"Rich" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default how to set a variable to a Chart? not ChartObject

Thanks all for your replies. Really appreciate it.

Rich
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete old chartobject and create a new named one? tskogstrom Charts and Charting in Excel 2 October 22nd 06 01:30 PM
Selecting chartobject without index no. Jaylin Charts and Charting in Excel 4 August 24th 06 04:31 PM
ChartObject Name Restricion or Excel Bug Gaston Excel Programming 0 February 14th 05 05:51 PM
Fill screen with chartobject by zooming? Gunnar Johansson Charts and Charting in Excel 1 December 15th 04 03:41 AM
ChartObject index Claude Excel Programming 3 January 30th 04 09:33 PM


All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"