SeriesCollection(i).Trendlines.Count > 0 Then Set chrtObj = Sheets("Sheet1").ChartObjects("Chart 1") ' Change to your sheet name here On the first iteration, B56 is offset 1 column so that your equation appears in C56. ![]() Here the Offset is moving 1 column to the right for each successive trend line. "Copies" the text of the equation to a specified Range.checks if the TrendLine is displaying its equation.This code only deals with the first but could be easily modified to loop through multiple trend lines. checks if the series in question has a at least one Trendline - note there could be multiple. ![]() If needed, you can change each instance of SeriesCollection to FullSeriesCollection. Here's a way to cycle through the SeriesCollection of a chart and extract the equation from the trend line associated with each Series in it. Sub Equations()ĪctiveSheet.ChartObjects("Chart 1").ActivateĪctiveChart.FullSeriesCollection(1).Trendlines(1).DataLabel.SelectĪctiveChart.FullSeriesCollection(2).Trendlines(1).DataLabel.SelectĪctiveChart.FullSeriesCollection(3).Trendlines(1).DataLabel.SelectĪctiveChart.FullSeriesCollection(4).Trendlines(1).DataLabel.SelectĪctiveChart.FullSeriesCollection(5).Trendlines(1).DataLabel.Select Now press the Ctrl key and then click the Y-Value column cells. I am trying to use macros to copy paste the equation of a trendline from a graph to a cell. First, select the ‘X-Value’ column cells.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |