title: Excel VBA - slow loop execution
body: <p>I created a loop (which worked perfectly yesterday) that copies a range of cells and then pastes their values one cell to the right, relative to each cell. The range consists of 91 cells and they're all separated by headers so I can't just select them all and paste the values since that "does not work on multiple selections." The idea is to copy the data from the "current day" range into the "previous day" range.</p>
  
  <p>So today when I ran the macro, it was extremely slow, doing around 1 cell per second. Excel became non-responsive after a few seconds but I could still see what it was doing on the screen. When the "cursor" caused the screen to scroll down, there was a grey area where the rest of the worksheet would normally be, you know what non-responsive windows look like. As soon as the cursor hit that grey area, the loop started going fast and finished in under a second. The CPU usage initially was &lt;1% but it went up to around 25% as soon as that happened.</p>
  
  <p>I put the loop in its own subroutine since it was part of a bigger macro that changes dates and other values, but there was no effect. The other macro (which has no other loops) runs perfectly when I removed that loop.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Here's the code for the loop:</p>
  
  <pre><code>Sub PreviousDay()
  
      Dim CDay As Range
      Set CDay = Range("CurrentDay")
  
      For Each Cell In CDay
          Cell.Copy
          Cell.Offset(0, 1).PasteSpecial Paste:=xlPasteValues
      Next Cell
      Application.CutCopyMode = False
  
  End Sub
  </code></pre>