Hello.
I wish a real good weekend for all.
I am loading the macro for the all coefficient trendline, first need to be editing (loop require), and the real point for me is to be able to write the range of "X and Y" variable for the all formulas from the location J1 and K1, I would like to be able to say for example I need the formulas work from line 25 to 35 only or from 10 to 21 for example so I can see how really work.
On A3 column is the X and B3 the rest.
Code:
  Sub Coe_fficient()Range("j3").Select
Selection.Formula = "=TRUNC(FORECAST(18,B3:B19,$A$3:$A$19))"
Range("j4").Select
Selection.Formula = "=TRUNC(TREND(B3:B19))"
Range("j5").Select
Selection.Formula = "=TRUNC(FORECAST(18,C3:C19,$A$3:$A$19))"
Range("j6").Select
Selection.Formula = "=TRUNC(TREND(C3:C19))"
Range("j7").Select
Selection.Formula = "=TRUNC(FORECAST(18,D3:D19,$A$3:$A$19))"
Range("j8").Select
Selection.Formula = "=TRUNC(TREND(D3:D19))"
Range("j9").Select
Selection.Formula = "=TRUNC(FORECAST(18,E3:E19,$A$3:$A$19))"
Range("j8").Select
Selection.Formula = "=TRUNC(TREND(E3:E19))"
Range("j10").Select
Selection.Formula = "=TRUNC(FORECAST(18,F3:F19,$A$3:$A$19))"
Range("j11").Select
Selection.Formula = "=TRUNC(TREND(F3:F19))"
Range("j12").Select
Selection.Formula = "=TRUNC(FORECAST(18,G3:G19,$A$3:$A$19))"
Range("j13").Select
Selection.Formula = "=TRUNC(TREND(G3:G19))"
Range("j14").Select
Selection.Formula = "=TRUNC(INTERCEPT(B3:B19,$A$3:$A$19))"
Range("j15").Select
Selection.Formula = "=TRUNC(INTERCEPT(C3:C19,$A$3:$A$19))"
Range("j16").Select
Selection.Formula = "=TRUNC(INTERCEPT(D3:D19,$A$3:$A$19))"
Range("j17").Select
Selection.Formula = "=TRUNC(INTERCEPT(E3:E19,$A$3:$A$19))"
Range("j18").Select
Selection.Formula = "=TRUNC(INTERCEPT(F3:F19,$A$3:$A$19))"
Range("j19").Select
Selection.Formula = "=TRUNC(INTERCEPT(G3:G19,$A$3:$A$19))"
Range("j20").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(B3:B37,LN($A$3:$A$37)),1,2))"
Range("j21").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(C3:C37,LN($A$3:$A$37)),1,2))"
Range("j22").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(D3:D37,LN($A$3:$A$37)),1,2))"
Range("j23").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(E3:E37,LN($A$3:$A$37)),1,2))"
Range("L3").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(F3:F37,LN($A$3:$A$37)),1,2))"
Range("L4").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(G3:G37,LN($A$3:$A$37)),1,2))"
Range("L5").Select
  Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(B4:B37),LN($A$4:$A$37),,),1,2)))"
Range("L6").Select
  Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(C4:C37),LN($A$4:$A$37),,),1,2)))"
Range("L7").Select
  Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(D4:D37),LN($A$4:$A$37),,),1,2)))"
Range("L8").Select
  Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(E4:E37),LN($A$4:$A$37),,),1,2)))"
Range("L9").Select
  Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(F4:F37),LN($A$4:$A$37),,),1,2)))"
Range("L10").Select
  Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(G4:G37),LN($A$4:$A$37),,),1,2)))"
Range("L11").Select
Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(B3:B19),$A$3:$A$19),1,2)))"
Range("L12").Select
Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(C3:C19),$A$3:$A$19),1,2)))"
Range("L13").Select
Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(D3:D19),$A$3:$A$19),1,2)))"
Range("L14").Select
Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(E3:E19),$A$3:$A$19),1,2)))"
Range("L15").Select
Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(F3:F19),$A$3:$A$19),1,2)))"
Range("L16").Select
Selection.Formula = "=TRUNC(EXP(INDEX(LINEST(LN(G3:G19),$A$3:$A$19),1,2)))"
Range("L17").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(B3:B19,$A$3:$A$19^{1,2}),1,3))"
Range("L18").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(C3:C19,$A$3:$A$19^{1,2}),1,3))"
Range("L19").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(D3:D19,$A$3:$A$19^{1,2}),1,3))"
Range("L20").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(E3:E19,$A$3:$A$19^{1,2}),1,3))"
Range("L21").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(F3:F19,$A$3:$A$19^{1,2}),1,3))"
Range("L22").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(G3:G19,$A$3:$A$19^{1,2}),1,3))"
Range("L23").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(B3:B19,$A$3:$A$19^{1,2,3}),1,4))"
Range("L24").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(C3:C19,$A$3:$A$19^{1,2,3}),1,4))"
Range("L25").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(D3:D19,$A$3:$A$19^{1,2,3}),1,4))"
Range("L26").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(E3:E19,$A$3:$A$19^{1,2,3}),1,4))"
Range("L27").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(F3:F19,$A$3:$A$19^{1,2,3}),1,4))"


Range("j48").Select
Selection.Formula = "=TRUNC(INDEX(LINEST(G3:G19,$A$3:$A$19^{1,2,3}),1,4))"
Range("a1").Select


End Sub
Code:
       
15 33
1 23 29 33 39 45 48 5 37
2 16 22 36 38 42 43 10 43
3 10 12 18 25 27 49 15 4
4 1 11 12 24 31 33 17 15
5 1 4 14 33 36 43 24 24
6 18 27 28 30 35 43 32 33
7 1 17 27 36 42 45 34 34
8 2 4 21 27 32 53 43 41
9 4 15 19 23 31 53 36 5
10 2 25 31 45 52 49 49 13
11 5 18 28 37 42 53 44 22
12 18 22 34 39 48 50 11 31
13 4 8 36 37 40 46 17 35
14 9 18 22 37 44 53 24 43
15 10 13 23 49 51 50 32 19
16 13 17 19 23 39 34 35 22
17 2 21 23 25 33 53 44 25
18 11 29 30 37 45 32 13 30
19 1 5 13 18 28 51 20 35
20 5 23 24 26 29 48 27 40
21 3 16 26 30 34 27 35 31
22 8 9 19 23 26 50 30
23 4 15 39 40 42 53 42
24 20 25 34 35 46 51 48
25 10 12 18 27 36 53 52
26 14 30 32 34 52 52
27 2 12 16 29 43 44
28 9 27 31 37 41 49
29 2 12 40 44 47 53
30 2 5 10 35 51 47
31 2 6 15 20 24 53
32 4 16 35 37 43 51
33 2 14 26 29 36 45
34 4 5 7 19 34 46
35 6 8 19 21 39 47
Thank you for reading this post.