title: How Do I Reference Columns In The Arrays So The Numbers Aren't Hardcoded?
body: <p>I am trying to make this as dynamic as possible. Is there a way to have the Arrays reference columns instead of them being hardcoded? </p>
  
  <p>The code I have is below and was provided by another gracious member of the community.</p>
  
  <pre><code>Sub Trend()
  Dim knownX, knownY, newX, TrendY
  Dim i As Long
  
  
  knownY = Array(0.00071, 0.00444, 0.00426, 0.00419, 0.00721, 0.00701, 0.00698, 0.01015, 0.01001, 0.00996, 0.01275, 0.01278)
  knownX = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
  newX = Array(13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36)
  TrendY = Excel.WorksheetFunction.Trend(knownY, knownX, newX)
  For i = LBound(TrendY) To UBound(TrendY)
      Debug.Print "X: " &amp; newX(i - 1), "Y: " &amp; TrendY(i)
  Next
  End Sub
  </code></pre>