Extract equation parameters from chart

Hello,

The attached worksheet contains a script (CreateCharts) that outputs a series of line charts and scatter charts (based on a range of input data) to a sheet named "Charts".

Each scatter chart on the "Charts" sheet contains an equation for a linear trendline.

The other script (SlopeTable) contained within this workbook is designed to read each chart and extract the chart title and slope of the trendline from the equation on the chart.

I am in need of an amendment to the SlopeTable script  that will read the equation on only the scatter charts and write the chart title, slope, y-intercept, and R-squared values to a  table in the sheet named "Params_Table".

For an example, I have shown the desired results for the first scatter chart (labeled as BR1) in row 2 of the "Params_Table". I entered these values manually.

Many thanks in advance to anyone who may be able to add this functionality,
equation-parameters-to-table.xlsm
LVL 1
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Hi,

pls try

``````Sub Findparameters()

RowIndex = 2

For Each ChtObj In Sheets("Charts").ChartObjects
Set cht = ChtObj.Chart
For Each SerCol In cht.SeriesCollection
Set TrdLines = SerCol.Trendlines
If TrdLines.Count > 0 Then
Set TrdLn = TrdLines(1)
strParameters = Replace(TrdLn.DataLabel.Text, Chr(10) & "R" & Chr(178), "")
strParameters = Replace(strParameters, "x", "")
aParameters = Split(strParameters, " ")
Range("A" & RowIndex).Value = cht.ChartTitle.Text

Range("B" & RowIndex).FormulaLocal = aParameters(2)
Range("C" & RowIndex).FormulaLocal = aParameters(4)
Range("D" & RowIndex).FormulaLocal = aParameters(6)
RowIndex = RowIndex + 1
End If

Next
Next

End Sub
``````
EDIT Now FormulaLocal

Regards

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

PartnerCommented:
ok here it is

download the file make sure macros are activated and position yourself in any sheet and activate the macro called SlopeTable and check the results.

Rgds/gowflow
equation-parameters-to-table.xlsm
Author Commented:
Many thanks for the responses.

Rgonzo1971 has the correct solution.

The response from gowflow causes the last four ID's to repeat the same value for each parameter. Not sure why this occurs? I do like the pop-up message window after execution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.