Page 330 - Excel for Scientists and Engineers: Numerical Methods
P. 330
CHAPTER 13 LINEAR REGRESSION AND CURVE FITTING 307
~
TLText = Application.Substitute(TLText, "e", "*EXP(")
TLText = Application.Substitute(TLText, "x", "*x")
End Select
'RETURN TO TRENDLINE TEXT TO RESTORE ORIGINAL NUMBER FORMAT
If ChartSheetNarne c> "" Then
Charts(ChartSheetName).Activate
Charts(ChartSheetNarne).C hartArea.Select
Else
ActiveSheet.ChartObjects(ChartObjectNarne).Activate
End If
ActiveChart.SeriesCoIlection(SeriesNurn) -
.TrendIines(TrendlineNum).DataLabel.Select
Selection.Num berFormat = TLNurnberForrnat
End Sub
Figure 13-17. VBA code for theTrendlineToCel1 utility.
The procedure is an Auto-Open macro; when you open the document, the
procedure installs a new menu command, Copy Trendline to Cell ..., in the
Tools menu of the Chart menu bar (see Figure 13-18), then hides itself.