Assuming the formula is a trendline on a graph, you can use this User
Defined Function:
Public Function DisplayEquation(Optional nSeries As Long = 1, _
Optional nChart As Long = 1)
Application.Volatile
DisplayEquation = Application.Caller.Parent. _
ChartObjects(nChart).Chart.SeriesCollection(nSeries). _
Trendlines(1).DataLabel.Text
End Function
From what I can tell XL updates charts only after it completes all
worksheet/book computations. So, the DisplayEquation() will *always*
trail the chart equation by one calculation cycle. To see the full
effect of this lag, use an equation that includes RAND() to calculate
the plotted values.
I was playing with something to extract the individual coefficients and
since I often use (embedded) RAND() calls to generate test data, I ran
into the lag effect from the very beginning.
--
Regards,
Tushar Mehta www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
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.