Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Charts(3).SetSourceData Not Working

Hi All,

I'm a bit confused here. If I run the command "msgbox
ActiveChart.Name" I get back "Sheet1 Chart 3".

Yet, if I run the command "Charts(3).SetSourceData..." I get a
"subscript out of range" error. This is true if I try 1, 2, 3, 4, 5,
and so on. However, if I run "ActiveChart.SetSourceData..." it works,
thus I know the issue is with the "Charts(3)" portion of the line.

What am I doing wrong?

Thanks!

Trip

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Charts(3).SetSourceData Not Working

Hi Trip

The parent of a chart on a worksheet is a ChartObject

Dim chtObj as ChartObject
Dim cht as Chart

Set chtobj = ActiveSheet.Chartobjects("Chart 3")
Set cht = chtobj.Chart

msgbox chtobj.Name & vbcr & cht.Name

cht..SetSourceData...

BTW, if you did not "Activesheet.Charts(3)" but
Activesheet.Chartobjects(3).Chart,
you would pick up the 3rd Chartobject's chart on the sheet according to its
index order, which is not necessarily related to the '3' in its name.

Regards,
Peter T

"Trip" wrote in message
oups.com...
Hi All,

I'm a bit confused here. If I run the command "msgbox
ActiveChart.Name" I get back "Sheet1 Chart 3".

Yet, if I run the command "Charts(3).SetSourceData..." I get a
"subscript out of range" error. This is true if I try 1, 2, 3, 4, 5,
and so on. However, if I run "ActiveChart.SetSourceData..." it works,
thus I know the issue is with the "Charts(3)" portion of the line.

What am I doing wrong?

Thanks!

Trip



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
defined names and setsourcedata Jason Morin Charts and Charting in Excel 2 December 5th 07 03:39 PM
setSourcedata tony wong Excel Programming 2 February 22nd 07 02:06 PM
SetSourceData for Chart Doerte Excel Programming 2 November 29th 04 11:55 AM
Activechart.SetSourceData Source??? Bob R Excel Programming 2 July 30th 04 03:39 PM


All times are GMT +1. The time now is 02:57 AM.

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"