I have problem with the following code. I am trying to copy data from one sheet "rp" and paste it into "peim" provided the if conditions is met. The code runs fine except it copy paste over the same cells in the destination sheet.
So there are about 6 entries in the source sheet and i want all 6 entries to be pasted in destination sheet in rows. But my code just over writes the same row with all 6 entries and only show the last entry. I dont know who to make it work so that it copy and paste paste each entry in the next available row.
Thanks in advance for any help.
So there are about 6 entries in the source sheet and i want all 6 entries to be pasted in destination sheet in rows. But my code just over writes the same row with all 6 entries and only show the last entry. I dont know who to make it work so that it copy and paste paste each entry in the next available row.
Code:
Sub final_Report()
Dim rng As Range
Dim PEIM_Report As Worksheet
Dim Report As Worksheet
Dim eDate As Date
Dim sDate As Date
Dim Sformula As String
Set peim = ThisWorkbook.Sheets("PEIM_Report")
Set rp = ThisWorkbook.Sheets("Report")
lr = rp.Cells(Rows.Count, 1).End(xlUp).Row
lrp = peim.Cells(Rows.Count, 1).End(xlUp).Row
For x = 6 To lr
If rp.Cells(x, 14).Value = "Yes" Then
rp.Range("A" & x, "F" & x).Copy
peim.Cells(lrp + 1, 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
Next x
End Sub
Thanks in advance for any help.