Hello All, I have a vba that copies a range of rows from columns Q-AY, the rows can be 1 to whatever (rows are line items on an order, so 1 order can be only 1 item, another order can be 50...).

The vba works but my issue is when it is copying the rows it is adding blank rows which is not making sense i.e. 2 line items but if I step through the macro 22line items are highlighted when I step into the range copy command but I do not see anything wrong with the logic.

Sub CopyPaste()
  Dim n As Long
  Dim O As Long
  Application.ScreenUpdating = False
  Dim copySheet As Worksheet
  Dim pasteSheet As Worksheet

  Set copySheet = Worksheets("ePRO Template")
  Set pasteSheet = Worksheets("HW Orders")
  For i = 1 To 52
  n = Cells(1, 1).End(xlDown).Row
  O = Cells(1, 1).End(xlDown).Row
    If IsEmpty(Range("R" & i + 1).Value) = False Then
    
        Range("Q2:AY2" & i + 1).Copy
        pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
    Else

        
        Exit Sub
   End If
  Next i
End Sub