Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default (Un)usual "cannot set Xvalues" error message

Okay guys, here's some code from my little userform.

It's basically a fancy database manipulation tool which, at some point,
plots the data onto a graph. The graph is pre-existing and all I want
to do is alter the series parameters to display or hide a line.

I have two functions that do this on the fly - one adds or removes 95%
confidence intervals from the graph.


***
If numseries = 1 Then

With Charts(2).SeriesCollection(2)
..Values = Worksheets("DataSet").Range("II33:II86")
..XValues = Worksheets("DataSet").Range("IF33:IF86")
..Name = "Series 1 Plus 95%"
End With

With Charts(2).SeriesCollection(3)
..Values = Worksheets("DataSet").Range("IJ33:IJ86")
..XValues = Worksheets("DataSet").Range("IF33:IF86")
..Name = "Series 1 Minus 95%"
End With

End If
***

This works every time.

The second adds or removes a line that marks the 50% survival point (by
drawing a line across until the appropriate day, and then dropping down
to zero).

***
If numseries = 1 Then

With Charts(2).SeriesCollection(13)
..Values = Worksheets("DataSet").Range("IE72:IE125")
..XValues = Worksheets("DataSet").Range("IF33:IF86")
..Name = "Series 1 50% losses"
End With

End If
***

This one crashes every time with error 1004.

Note that the .Values parameter is set, but it falls over when it
reaches the .Xvalues parameter. Also note that the range used for the
..XValues parameter in both instances IS THE SAME.

Same graph. Same code. Same range. All series exist. I'm using a
scatter graph plotting a line with no datapoints shown: the default
version.

Do the series have to be consecutive? In this situation I normally
have series 4 through 12 inactive (X and Y values set to zero) unless
I'm analysing more than one set of data - but the same error occurs
even if I have the other series filled (analysing 4 sets of data with
confidence intervals).

Any ideas as to why this rather obscure error should crop up? What
actually prevents a series from having its Xvalues parameter
modified...? If I could see a difference between the two codes it
would make more sense, but I literally cut and pasted it across and
modified the range values for the V values.

Cheers

Bennett

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default (Un)usual "cannot set Xvalues" error message

ARRRGGGHHH!!!

RTFM.

I suspected this but the helpfile confirmed it:

Ranges must contain data when passed to a series. When I read that I
suddenly remembered about a line of code I'd got tucked away that
cleaned up prior to any calculations. At least, it was supposed to be
prior...

Wierdly it was the Y-values that were dataless. I had moved the "write
the data" code to occur before the "reset the worksheet" code.
Basically I was writing the data then deleting it, then trying to graph
it.

Error 1004.

The odd thing was that it was occuring at the .Xvalues point and not
the .Values point, where the error actually was. This is what sent me
off down the wrong path. However, when I moved the code around the
error was solved, so that must have been the reason.. The 95%
confidence interval data was not affected in this way since it has a
separate clean-up procedure.

If this helps anyone all the better I suppose :o) This is important to
watch for because the two chunks of code were in entirely separate
subroutines (they are now combined in one) which made troubleshooting
all that more difficult. Sometimes object-oriented programming isn't
the best way to go ;-)

Cheers

Bennett

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
Pivot Table Error Message - "too many records" Excel 2007 MAK Excel Discussion (Misc queries) 0 November 5th 08 09:19 PM
"Unable to Read File" error message in Excel - solutions? Presby Loaner Excel Discussion (Misc queries) 2 June 27th 07 05:09 PM
How do I ignore the "Number stored as text" error message permane. reston33 Excel Discussion (Misc queries) 2 March 28th 07 02:59 AM
Deleted the pivot table - continue to get the "overlap" error message [email protected] Excel Discussion (Misc queries) 0 September 27th 06 04:07 PM
"GoalSeek method of Range object failed" error message Fixit_Steve Excel Programming 0 January 13th 05 07:29 PM


All times are GMT +1. The time now is 01:16 PM.

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"