LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem programming .SeriesCollection().XValues and .Values

I'm confused too, your code appeared to be applying an address not a name,
hence my example was loosly based on correcting (way below) -

sY_data_range = "'" & ActiveSheet.Name & "'!" & Y_data_range.Address


This should work with for a named range -

s = "='" & ActiveWorkbook.Name & "'!" & "myName
mySeries.Values = s ' or .XValues = s

I confess though I may not have read your code fully.
However in your slightly later post all appears to be working, great <g

Regards,
Peter T

"Greg Fish" wrote in message
...
Okay I am confused now, so what is the point of using the named range, if

I
am just going to end up putting in the R1C1 style reference? This just

seems
inordinately difficult.

I am not sure if I follow your syntax
s = s & myRange.Address(ReferenceStyle:=xlR1C1) ' or .Address(, , xlR1C1)
mySeries.Values = s ' or .XValues = s

Forgive my exasperation, but this has been far more difficult than I ever
imagined, and I am rapidly running out of time.

"Peter T" wrote:

from your slightly earlier post

.XValues = "=" & X_data_range


LIND OF CODE ABOVE TRIGGERS RUN TIME ERROR UNABLE TO SET THE
XVALUES PROPERTY OF THE SERIES CLASS


and below
.XValues = "=(" & sX_data_range & ")" STILL ERRORING OUT


You don't want those brackets but -

Change the range address to R1C1 style, eg

s = "='" & ActiveWorkbook.Name & "'!"
s = s & myRange.Address(ReferenceStyle:=xlR1C1) ' or .Address(, ,

xlR1C1)
mySeries.Values = s ' or .XValues = s

Regards,
Peter T



"Greg Fish" wrote in message
...
After taking in the advice and pouring over this forum, not to mention
several Google searches have rewritten the Sub routine as follows:

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, X_data_range As Range
Dim Y_est_data_range, X_est_data_range As Range
Dim sY_data_range As String
Dim sX_data_range As String
Dim sY_est_data_range As String
Dim sX_est_data_range As String
Dim fittedCurve As String
Dim fuelCurve As ChartObject

Worksheets(2).Activate
Set Y_data_range = ActiveSheet.Range(y1Axis)
Set X_data_range = ActiveSheet.Range(x1Axis)
Set Y_est_data_range = ActiveSheet.Range(y_EST)
Set X_est_data_range = ActiveSheet.Range(x_EST)
sY_data_range = "'" & ActiveSheet.Name & "'!" &

Y_data_range.Address
sX_data_range = "'" & ActiveSheet.Name & "'!" &

X_data_range.Address
sY_est_data_range = "'" & ActiveSheet.Name & "'!" &
Y_est_data_range.Address
sX_est_data_range = "'" & ActiveSheet.Name & "'!" &
X_est_data_range.Address
fittedCurve = curve

Worksheets(1).Activate
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
With .SeriesCollection.NewSeries

.XValues = "=(" & sX_data_range & ")" STILL ERRORING OUT
.Values = "=(" & sY_data_range & ")"
.Name = "Data"
End With
With .SeriesCollection.NewSeries
.Name = "Estimated"
.XValues = "=" & X_est_data_range
.Values = "=" & Y_est_data_range
End With
End With
End Sub

The annoying part is, still getting the same error message.

Absolutely
frustrating especially when I KNOW that the value for sX_data_range

is in
fact the correct data, and address for the named range. This could

not be
anymore frustrating, not to mention having a pending deadline.






 
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 11:48 AM.

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"