Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to set series data in VBA

I have been struggling for a long time trying to find a
robust way of being able to set the range of values for a
scatter plot series. I have found a variety of answers
on the web - it seems to be a common problem. The code
that I found worked best for me was this:

With ActiveChart.SeriesCollection(6)
.Values = dataSheet1.Range(col1 & "2:" & col1 &
numRows1)
.XValues = dataSheet1.Range(col2 & "2:" & col2 &
numRows1)
End With

This had been working perfectly for six or seven scatter
plots within the workbook. I have recently added another
scatter plot using the same code. It works most of the
time, however, for certain data selections it comes up
with the same error that I have been battling with for
ages:

Run-time error '1004'

Unable to set the XValues property of the Series class

The data range that I am trying to set it to consists of
either numbers or NA(). When there is a bug, if I debug
and then go back to the chart and manually set the data
then there is no problem and the chart is correct and the
macro then proceeds without fault.

I don't understand why it works in most cases. Is there
a robust method of setting series data for scatter plots
(all my histograms work with no problems)?

Any help is much appreciated,

Tim Archer

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
Time Series and Creating data points within a series Cristal Excel Discussion (Misc queries) 2 November 30th 09 08:07 PM
chart with two data series and two colors for each data series bikash Charts and Charting in Excel 0 January 17th 08 02:04 AM
2nd Axes - primary series data of only 1 series disappears! cheriw Charts and Charting in Excel 1 February 23rd 06 12:32 AM
how do I plot a data series against two series Frustrated in Sydney Charts and Charting in Excel 7 February 16th 06 04:24 AM
chart data series -- plot a table as a single series hjc Charts and Charting in Excel 7 September 20th 05 05:52 PM


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