PC Review


Reply
Thread Tools Rate Thread

ChartObjects problem - can you check if a ChartObject is"full/contains data"?

 
 
Tommy
Guest
Posts: n/a
 
      21st Feb 2008
Have a funny little problem here guys. I have a program the firstly
calls a function that creates 6 blank ChartObjects. The function
returns them so that they are stored in an array called Chart(x) where
x can be 1 to 6.

The code then reads in a number from a cell which is stored in a
variable called PlotNumber. This number is the number of the chart on
which to plot a range of data. So if PlotNumber = 3, then Chart(3)
would be the chart to have the data plotted on it.

The range selected is actually dependent on the PlotNumber as well,
but that is nothing to worry about with this problem. Anyway, my code
to write the data onto the chart:

Set ChartRange =
Worksheets("Data").Range(RangeTemp(PlotNumber).Address)

Chart(PlotNumber).Select
ActiveChart.SetSourceData (ChartRange)

This works perfectly. The problem comes when I decide I want to plot a
different set of data on a different chart. Let's say that Chart 3
already has data on it but I now want to put some data on to Chart 1
whilst keeping the same data on Chart 3. Ideally I would like a
function or a subroutine that could handle this so that I can just
read in the PlotNumber, pass it to the function/sub and then plot that
data whilst retaining all the other charts as they were previously.


 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      21st Feb 2008
I don't understand. If PlotNumber is 1, why does ChartObject(3) care what
happens?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Tommy" <(E-Mail Removed)> wrote in message
news:febb8966-d08b-4eb4-b9e4-(E-Mail Removed)...
> Have a funny little problem here guys. I have a program the firstly
> calls a function that creates 6 blank ChartObjects. The function
> returns them so that they are stored in an array called Chart(x) where
> x can be 1 to 6.
>
> The code then reads in a number from a cell which is stored in a
> variable called PlotNumber. This number is the number of the chart on
> which to plot a range of data. So if PlotNumber = 3, then Chart(3)
> would be the chart to have the data plotted on it.
>
> The range selected is actually dependent on the PlotNumber as well,
> but that is nothing to worry about with this problem. Anyway, my code
> to write the data onto the chart:
>
> Set ChartRange =
> Worksheets("Data").Range(RangeTemp(PlotNumber).Address)
>
> Chart(PlotNumber).Select
> ActiveChart.SetSourceData (ChartRange)
>
> This works perfectly. The problem comes when I decide I want to plot a
> different set of data on a different chart. Let's say that Chart 3
> already has data on it but I now want to put some data on to Chart 1
> whilst keeping the same data on Chart 3. Ideally I would like a
> function or a subroutine that could handle this so that I can just
> read in the PlotNumber, pass it to the function/sub and then plot that
> data whilst retaining all the other charts as they were previously.
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when create chartobject on line ".HasTitle = True" tskogstrom Microsoft Excel Charting 2 23rd Nov 2006 07:44 PM
Does "Automatic name checking" check for full name? =?Utf-8?B?TWVsaXNzYQ==?= Microsoft Outlook Discussion 2 25th Jan 2006 09:30 AM
Hide "Record" "Closed Caption" "Parental Control" indicators while in full screen Jordan ATI Video Cards 0 18th Feb 2005 05:21 PM
"Check Disk" similar to full format? Peter Rossiter Windows XP General 14 14th May 2004 03:17 PM
"Check Disk" similar to full format? Peter Rossiter Windows XP Hardware 10 14th May 2004 03:17 PM


Features
 

Advertising
 

Newsgroups
 


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