Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mrt mrt is offline
external usenet poster
 
Posts: 70
Default 2007: Charts.Add

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Charts.Add

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Charts.Add

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" wrote in message
...
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
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
Charts in 2007 Steve Excel Discussion (Misc queries) 0 March 9th 10 01:37 PM
Overlay charts in 2007 Christyr Charts and Charting in Excel 2 February 23rd 10 07:14 PM
Lost charts in 2007 Moops Excel Discussion (Misc queries) 0 September 2nd 09 08:46 AM
Dynamic charts in 2007 ker_01 Charts and Charting in Excel 2 May 27th 09 02:04 PM
Excel 2007 charts Lynn Excel Discussion (Misc queries) 3 February 4th 09 10:19 AM


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

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

About Us

"It's about Microsoft Excel"