LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Unable to set the xvalues (or values) property of the series class

I'm trying to code a dynamic chart series (two series), with
one common x-axis. The length of the series, and the
location of the columns holding the series can both change.

I have used the cells method of the range object to do this.
It works sometimes, and other times I get the error shown
in the subject of this email. This is the code:


Dim nrows As Integer, ncolumns As Integer

'sheet containing the data series and xvalues
Sheets("Intermediate Output").Select
'determine number of rows to plot
Range("a1").Select
Selection.End(xlDown).Select
nrows = ActiveCell.Row

'determine number of columns having data
Range("a1").Select
Selection.End(xlToRight).Select
ncolumns = ActiveCell.Column

Charts("BOD Plot").Activate

With Worksheets("intermediate output")
'define ranges for series
ActiveChart.SeriesCollection(1).XValues = _
.Range(.Cells(2, 1), .Cells(nrows, 1))
ActiveChart.SeriesCollection(1).Values = _
.Range(.Cells(2, (ncolumns - 1)), _ .Cells(nrows,
(ncolumns - 1)))
ActiveChart.SeriesCollection(2).XValues = _
.Range(.Cells(2, 1), .Cells(nrows, 1))
ActiveChart.SeriesCollection(2).Values = _
.Range(.Cells(2, (ncolumns - 2)), _ .Cells(nrows,
(ncolumns - 2)))
End With

When it DOESN'T work, if I step through the code and insert
the cursor at various places to attempt to ascertain what
actual values the program is getting for the cells, I may
find something like "(ncolumns-2)=331"! Which doesn't make
any sense to me, as ncolumns itself may only equal 36!!

Does anyone have any ideas for how to fix this, or why it
doesn't work???

Thank you all,
Kate
 
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
unable to set the values property of the series class BHatMJ Excel Discussion (Misc queries) 4 July 10th 09 03:46 PM
Unable to set the XValues property of the Series class Ben Charts and Charting in Excel 7 December 7th 06 10:01 PM
Unable to set the XValues property of the Series class ramkumar_cpt Charts and Charting in Excel 5 November 29th 05 02:13 PM
Unable to set the XValues property of the Series class David Mullins via OfficeKB.com Excel Programming 0 January 26th 05 02:54 PM


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