PC Review


Reply
Thread Tools Rate Thread

2007: Charts.Add

 
 
=?Utf-8?B?TXJU?=
Guest
Posts: n/a
 
      26th Nov 2006
Again something different (and not nice !!!) with 2007 (it's amazing how much
is necessary to have your all code doing the same thing as with previous
versions) :

Lets take a sheet with column A empty. add text in the first 5 rows of
column B. Select A1. Then do

ActiveWorkbook.Charts.Add

This will add a chartsheet with an ugly series that you never asked for.

Do the same with the previous versions. You will have an empty chart,
waiting for your instructions to add series.

MrT

 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      28th Nov 2006
Okay, duplicated. It seems Excel 2007 looks for a range not only containing
the active cell, but also just touching it, when guessing what range to use.
Prior versions only used a range that the active cell was part of.

I always clear out the chart of series at the beginning anyway, or
explicitly set a data range, because you can never be sure what cell or
range is selected when the code runs:

Do Until ActiveChart.SeriesCollection = 0
ActiveChart.SeriesCollection(1).Delete
Loop

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


"MrT" <(E-Mail Removed)> wrote in message
news:4AF12DD7-3D96-4F74-8115-(E-Mail Removed)...
> Again something different (and not nice !!!) with 2007 (it's amazing how
> much
> is necessary to have your all code doing the same thing as with previous
> versions) :
>
> Lets take a sheet with column A empty. add text in the first 5 rows of
> column B. Select A1. Then do
>
> ActiveWorkbook.Charts.Add
>
> This will add a chartsheet with an ugly series that you never asked for.
>
> Do the same with the previous versions. You will have an empty chart,
> waiting for your instructions to add series.
>
> MrT
>



 
Reply With Quote
 
=?Utf-8?B?TSBLbGF1cw==?=
Guest
Posts: n/a
 
      7th Feb 2007
The Do-Loop works well to get rid of unwanted series when you add a chart.

However, I have found that, if you then add a new series and there is data
in more than one column, the chart SOMETIMES ends up with more than the one
series you tried to add. It depends on where the data is in the worksheet
and if it is hidden - very strange and disappointing. None of this was an
issue on 2000 thru XP.

My workaround for this is to:
1) Activate an empty worksheet before adding a chart. This way the chart
will not "see" any data that it can grab hold of and will behave when you add
a new series. You also do not need the DO-LOOP workaround; you end up with
an empty chart.

2) Add the series for your chart

3) Relocate the chart to the desired worksheet after adding all the series
you want

4) Delete the empty worksheet
--
MKlaus


"Jon Peltier" wrote:

> Okay, duplicated. It seems Excel 2007 looks for a range not only containing
> the active cell, but also just touching it, when guessing what range to use.
> Prior versions only used a range that the active cell was part of.
>
> I always clear out the chart of series at the beginning anyway, or
> explicitly set a data range, because you can never be sure what cell or
> range is selected when the code runs:
>
> Do Until ActiveChart.SeriesCollection = 0
> ActiveChart.SeriesCollection(1).Delete
> Loop
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutions
> http://PeltierTech.com
> _______
>
>
> "MrT" <(E-Mail Removed)> wrote in message
> news:4AF12DD7-3D96-4F74-8115-(E-Mail Removed)...
> > Again something different (and not nice !!!) with 2007 (it's amazing how
> > much
> > is necessary to have your all code doing the same thing as with previous
> > versions) :
> >
> > Lets take a sheet with column A empty. add text in the first 5 rows of
> > column B. Select A1. Then do
> >
> > ActiveWorkbook.Charts.Add
> >
> > This will add a chartsheet with an ugly series that you never asked for.
> >
> > Do the same with the previous versions. You will have an empty chart,
> > waiting for your instructions to add series.
> >
> > MrT
> >

>
>
>

 
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
Link Charts in Powerpoint 2007 from Excel 2007 keyurshroff Microsoft Powerpoint 0 7th Mar 2011 10:22 AM
Charts in 2007 - Where are the new charts from Office 2007? Andre Microsoft Access Form Coding 1 29th Nov 2009 10:00 PM
Pasting Excel 2007 Charts Into Word 2007 Ted Microsoft Word Document Management 0 24th Mar 2009 02:13 PM
Convert linked Excel charts to embedded Excel charts in PPT 2007 Mohan Kumar Karunakaran Microsoft Powerpoint 2 26th Sep 2008 02:30 PM
Errors when copy/paste charts from Excel 2007 to PPT 2007 =?Utf-8?B?Y2RlbGFuZXk=?= Microsoft Powerpoint 2 4th Aug 2006 04:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:05 PM.