title: How to make a simple "Sum" loop faster?
body: <p>I am beginning to learn how to use loops and arrays but this one has me stuck. Below is a code that loops through cells and adds them together in column P.</p>
  
  <pre><code>Sub Loop_Test()
  
  Dim sht1 As Worksheet
  Dim lr As Long
  Dim i As Long
  
  Set sht1 = Worksheets("Sheet1")
  lr = Fcst.Cells(Rows.Count, "A").End(xlUp).Row
  
      With sht1
          For i = 4 To lr
  
              .Range("P" &amp; i).Value = Application.Sum(Range("D" &amp; i, "O" &amp; i))
  
          Next 
      End With
  
  End Sub
  </code></pre>
  
  <p>Overall, this code works but it is very slow and I need to apply it to thousands of rows. I know that in order to make this faster, I need to turn the sum range into an array but I am not entirely sure how to do this when a loop is included. </p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>G</p>
  
  <p>Disclaimer: I know there are more efficient ways to sum cells together but this is just me playing around and learning.</p>