PDA

View Full Version : Solved: Option to extend trend line on graph



BENSON
07-12-2013, 10:34 AM
Ideally I would like to amend the code belowto allow the user the option to select the amount of periods to advance the trend line.Maybe by Msg or a control form.It is currently set for 3 periods,

thks Pete


Sub OptionButton9_Click()
'
' OptionButton9_Click Macro
' Macro recorded 2013/07/10 by Peter Beckett
'
'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Trendlines(1).Select
With Selection
.Type = xlLogarithmic
.Forward = 3
.Backward = 0
.InterceptIsAuto = True
.DisplayEquation = False
.DisplayRSquared = False
.NameIsAuto = True
End With
ActiveChart.SeriesCollection(1).Trendlines(1).Select
With Selection
.Type = xlLogarithmic
.Forward = 3
.Backward = 0
.InterceptIsAuto = True
.DisplayEquation = False
.DisplayRSquared = False
.NameIsAuto = True
End With
ActiveWindow.Visible = False

Range("D17").Select
End Sub

mancubus
07-12-2013, 03:17 PM
you can use inputbox





...
...
prd = Application.InputBox("Enter the numer of periods to extend.", "FORWARD", , , , , , 1)
...
...
.Forward = prd
...
...