title: VBA - paste as values
body: <p>I'm struggling with code, which should copy the cell and paste it to the below's row (it the below's row is empty / if not it searches for other rows)</p>
  
  <pre><code> Sub CopyRows2()
  
  Dim LastRow As Long
  
  With Worksheets("OUTPUT") ' &lt;-- here should be the Sheet's name
      LastRow = .Cells(.Rows.Count, "O").End(xlUp).Row ' last row in column B
  
  For i = 2 To LastRow
  If Range("O" &amp; i) &gt; "" And Range("O" &amp; i + 1) = "" Then
      Range("O" &amp; i).Copy
      Range("O" &amp; i + 1).Select
      ActiveSheet.Paste
      Application.CutCopyMode = False
  Else
      End If
  Next
  
  End With
  
  ActiveWindow.ScrollRow = 1 'scrolling the screen to the top
  
  End Sub
  </code></pre>
  
  <p>This way, it works fine, but in the cells above are formulas and therefore I would need to copy only values, since the results should be same. I've found, that I should replace this part:</p>
  
  <pre><code>ActiveSheet.Paste
  </code></pre>
  
  <p>by this part:</p>
  
  <pre><code>ActiveSheet.PasteSpecial xlPasteValues
  </code></pre>
  
  <p>But once I did it, it has showed me an error msg <strong>Run-time error 1004</strong> and the macro has stucked after copy 1st cell, then find the empty cell... but it has not inserted the value and has not continue in searching.</p>
  
  <p>Could I ask you for a help, please? What am I missing there? I cannnot see the mistake.</p>
  
  <p>Thank you!</p>