Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Changing XValues and Values in a chart

I have a subroutine that makes a scatterplot for ranges (.XValues & .Values)
that can't be predicted.

I want to add my own ranges to the scatterplot, for example by:

Dim XValuesToAddTo as variant
With ActiveChart.SeriesCollection(1)
XValuesToAddTo = .XValues
XValuesToAddTo = XValuesToAddTo & some new ranges
.XValues = XValuesToAddTo
etc

There are several posts on the web that say that this sort of thing doesn't
work, but there's no explanation and nobody has proposed another way of
doing it.

It's a bit like assigning a range to a variable: you need to know that this
only works for the .Cells property, but nobody seems to know why. Perhaps
XValues has some property we don't know about.

Can anybody explain what's going on in this kind of situation, or is Excel
VBA just flaky in this area?

Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Changing XValues and Values in a chart

In your code, XValuesToAddTo is an array, even if the chart points to a range.

What you can do is parse the SERIES formula to get the range (use John Walkenbach's
Chart Series Formula Class Module, http://j-walk.com/ss/excel/tips/tip83.htm), then
use Union to combine the existing range with whatever additional ranges you need.

I dunno what you mean about the .Cells and variables.

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

lee.christopher wrote:

I have a subroutine that makes a scatterplot for ranges (.XValues & .Values)
that can't be predicted.

I want to add my own ranges to the scatterplot, for example by:

Dim XValuesToAddTo as variant
With ActiveChart.SeriesCollection(1)
XValuesToAddTo = .XValues
XValuesToAddTo = XValuesToAddTo & some new ranges
.XValues = XValuesToAddTo
etc

There are several posts on the web that say that this sort of thing doesn't
work, but there's no explanation and nobody has proposed another way of
doing it.

It's a bit like assigning a range to a variable: you need to know that this
only works for the .Cells property, but nobody seems to know why. Perhaps
XValues has some property we don't know about.

Can anybody explain what's going on in this kind of situation, or is Excel
VBA just flaky in this area?

Regards
.



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
xl2007 - Reading Values and XValues Greg Wilson Charts and Charting in Excel 0 March 1st 09 06:33 PM
.Values / .XValues modification baconcow Excel Discussion (Misc queries) 4 September 29th 08 11:06 PM
Displaying XValues and Values for chart using VBA Barb Reinhardt Charts and Charting in Excel 2 January 13th 06 01:34 AM
Problem with plotting a chart when using arrays as Values and Xvalues [email protected] Charts and Charting in Excel 3 August 19th 05 09:05 PM
XValues and values. y Excel Programming 3 April 10th 04 03:13 AM


All times are GMT +1. The time now is 10:04 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"