Chart trendline equation - can you get it?

J

Justin Rich

In the code it shows this

ActiveChart.SeriesCollection(1).Trendlines.Add(Type:=xlPolynomial, Order:=3
_
, Forward:=0, Backward:=0, DisplayEquation:=True, DisplayRSquared:=
_
False).Select


DisplayEquation=True

the equation that it is refering to, is there any way to get this?

I gather this creates an Trendline object which i was digging around in, and
only found a way to display the equation. Is there something im missing?

thanks
Justin
 
P

Peter

You can retrieve the trendline equation from ActiveChart.SeriesCollection(x).Trendlines(x).Datalabel.Text, but since it comes with no formatting, it could be difficult to tell exactly what the equation is ("Is that x squared, or x times 2?").
You could walk Trendlines(x).Characters, determine the formatting of each character (mainly interested in super/sub-script, probably), and parse out a plain-text equation from that, perhaps...

hth,

-Peter
 
J

Jonathan West

Hi Justin,

This group deals with VBA in Word. The Excel VBA experts can be found in the
group microsoft.public.excel.programming. You are more likely to find people
who know the answer to your question if you post it there.
 
J

Justin Rich

thanks, didnt think to check for 'programming'
figured word would be ok cuz it uses chars as well.. but as you can see an
answer was posted.
thanks for everyone help.
 
J

Justin Rich

Thank you.


"Peter" <peterguy -at- hotmail -dot- com> wrote in message
You can retrieve the trendline equation from
ActiveChart.SeriesCollection(x).Trendlines(x).Datalabel.Text, but since it
comes with no formatting, it could be difficult to tell exactly what the
equation is ("Is that x squared, or x times 2?").
You could walk Trendlines(x).Characters, determine the formatting of each
character (mainly interested in super/sub-script, probably), and parse out a
plain-text equation from that, perhaps...

hth,

-Peter
 

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