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: 10
Default Problem programming .SeriesCollection().XValues and .Values

Hi everyone. I am having a difficult time programmatically assigning a named
range using the method SeriesCollection().XValue and SeriesCollection().Value.

I keep getting the following error message, "Run time error '1004' Unable to
set the Values property of the Series class. I am fairly novice VBA
programmer, mostly self taught, I have learned signigicantly over the last
few months but cannot overcome this one error. I have tried to emulate the
code written by Jon Peltier in his VBA and Chart primer, from his website.

my code is below,

Sub graphIt(x1Axis As String, y1Axis As String, x_EST As String, y_EST As
String, curve As String)
Dim objWorkSheet As Object
Dim Y_data_range As String
Dim X_data_range As String
Dim Y_est_data_range As String
Dim X_est_data_range As String
Dim fittedCurve As String
Dim fuelCurve As ChartObject

Set Y_data_range = OLEObject.Sheet(Sheet2).Range(y1Axis)
X_data_range = x1Axis
Y_est_data_range = y_EST
X_est_data_range = x_EST
fittedCurve = curve

Set fuelCurve = ActiveSheet.ChartObjects.Add _
(Left:=500, Width:=750, Top:=150, Height:=450)
With fuelCurve.Chart

'make smoth XY Scatter Chart
.chartType = xlXYScatterSmooth
'
' add series from selected name ranges
.SeriesCollection(1).Name = "Data" (ERROR occurs here)
.SeriesCollection(1).XValues = "=(Sheet2!)" & X_data_range
.SeriesCollection(1).Values = "=" (Sheet2!)" & Y_data_range
.SeriesCollection(2).Name = "Estimated"
.SeriesCollection(2).XValues = "=(Sheet2!)" & X_est_data_range
.SeriesCollection(2).Values = "=(Sheet2!)" & Y_est_data_range
End With
End Sub


Regards,
Greg
 
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
Limit on array when using seriescollection.XValues and .Values met Pasi Husso Excel Programming 2 October 25th 06 08:05 AM
SeriesCollection(i) and XValues= Array() error MJKulangara Excel Programming 3 April 12th 06 07:50 PM
Can't set Chart's SeriesCollection XValues BW Excel Programming 2 September 26th 05 05:32 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
Problem with setting values for SeriesCollection Jon Peltier[_3_] Excel Programming 1 September 3rd 03 04:20 AM


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