

On Error GoTo BadSelection 'Selection.Name e.g., "Text S3T1" If Selection.Name Like "Text S*T*" Then pointer = Application.Find('T", Selection.Name, 3) SeriesNum = Val(Mid(Selection.Name, 7, pointer - 7)) TrendlineNum = Val(Mid(Selection.Name, pointer +1,3)) ElseīadSelection: MsgBox "You must select a Trendline label." Exit Sub End If On Error GoTo 0 'REMEMBER LOCATION OF CHART If TypeName(ActiveSheet) = "Chart" Then ChartSheetName = ActiveSheet.Name Else pointer = Application.Find("Chart", ActiveChart.Name) ChartObjectName = Mid(ActiveChart.Name, pointer, 100) End If 'Tranfers Trendline text to cell as formula. The utility TrendlineToCell provided on the CD-ROM converts the Trendline equation to an Excel formula and transfers the formula to a selected cell on a worksheet. The disadvantage of Trendline is that the trendline equation is merely a caption in the chart to use it in the worksheet, the coefficients must be transferred manually by typing, or copying and pasting. Trendline provides a limited gallery of mathematical fitting functions, including regular polynomials up to order six.


Scientists and engineers often use Excel's Trendline feature to obtain a least-squares fit to data in a chart.
