Extracting XValues Formula string From Series collection ?

D

Dan Thompson

This is very frustrating I currently have this code

Sub Test()
Dim X
X = ActiveChart.SeriesCollection(1).Formula
Debug.Print X
End Sub

The above code works fine and outputs
=SERIES("MyChart",data!$FK$597:$FK$638,data!$FJ$597:$FJ$639,1)
which is what I want however ........

When I try this code

Sub Test()
Dim B
B = ActiveChart.SeriesCollection(1).XValues.Formula
Debug.Print B
End Sub

I get a runtime error 424 Object Requiered

What am I doing wrong Surely there is a method to return the formula string
value of the XValues of a chart series ??

Dan Thompson
 
P

Patrick Molloy

agreed, quite odd, but i guess there's some logic behind the object model
if you break at the debug line and look at xy in the watch window you'll see
that it's of type 'string' and looking at cl in the watch window, cl.xyvalues
is a collection of strings...i see no formula here

i suspect that the formula that you want is buried in the chart object
somewhere though

Sub Test()
Dim cl As Series, xy 'As Object
Set cl = ActiveChart.SeriesCollection(1)
For Each xy In cl.XValues
Debug.Print xy
Next
End Sub
 
P

Peter T

What is it that you are trying to do that I haven't already shown you how to
do in your other threads.

Regards,
Peter T
 
P

Peter T

i suspect that the formula that you want is buried in the chart object
somewhere though

It's not buried, the XValues is the second section of the formula
It's simple to make that a range object, assuming the XValues are sourced to
cells (as demonstrated in other threads)
cl.xvalues is a collection of strings...

It's an array of values

Regards,
Peter T
 
P

Patrick Molloy

ok

Peter T said:
It's not buried, the XValues is the second section of the formula

It's simple to make that a range object, assuming the XValues are sourced to
cells (as demonstrated in other threads)


It's an array of values

Regards,
Peter T
 
D

Dan Thompson

Sorry agian for the confusion Peter I have figured out the issue on this
XValues thing now. The confusion was do to my lack of understanding

I was trying to use the .formual property to return a range string from the
XValues which I now know doesn't work because XValues can only return an
values or named array not a range.
It's not buried, the XValues is the second section of the formula
I know get your above statement i did not realize about that before do to my
novice'ness
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top