LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
 
Posts: n/a
Default Problem with plotting a chart when using arrays as Values and Xvalues

Hi

I am trying to generate a chart from VBA arrays, but I am finding that
once the arrays become too large I get the following runtime error:

Run-time error '1004':
Unable to set the XValues property of the Series class

A simple piece of code which reproduces the error:

Option Base 1
Sub test()
Const nPts As Long = 81 'if increase this to = 82, doesn't work!
Dim x(nPts) As Double, y(nPts) As Double
Dim i As Long

For i = 1 To nPts
x(i) = i
y(i) = i
Next i

'Create graph
Set Graph = ActiveSheet.ChartObjects.Add _
(Left:=100, Width:=375, Top:=75, Height:=225)

Graph.Activate

'Plot Data
With ActiveChart.SeriesCollection.NewSeries
.Name = "Data"
.XValues = x
.Values = y
.ChartType = xlXYScatter
End With
End Sub

This is with Excel 2003.
Any help with be fantastic!
Jonathan

 
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
Urgent Chart Questions Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM
Urgent Chart Assistance Requested Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM
Prevent non-numerical data (e.g. text) from plotting on a chart jaweiss Charts and Charting in Excel 1 March 19th 05 05:54 PM
Problem adding Series XValues to Chart using VBA Sean Curry Charts and Charting in Excel 0 March 14th 05 12:18 AM
Strange Problem with Chart and Plot Visible Cells Option Marcus Leon Charts and Charting in Excel 1 January 7th 05 03:52 AM


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