Inserted row should paste in 7times in next sheet based on the date [Solved]

Report
Posts
2
Registration date
Thursday March 5, 2020
Status
Member
Last seen
March 5, 2020
-
Posts
2638
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
August 4, 2020
-
Hello,
i have a template and from client a workbook will i should compare and paste the data if any new row der i should insert in template file and that inserted data should also paste 7times in the same workbook and sheet name is upload.

but main problem is inserted data is in rows and in upload we should check the date creteria and paste it whr the row inserted in template file

below is the code for comparing and inserting the row in template

Sub Copy_Paste()
Application.EnableEvents = False

Dim x, y As String
Dim i, j As Integer

x = Application.GetOpenFilename()
Set wb = Workbooks.Open(x)
y = Application.GetOpenFilename()
Set ws = Workbooks.Open(y)


lrow = wb.Sheets("Input").Range("A" & Rows.Count).End(xlUp).Row
drow = ws.Sheets("Output").Range("A" & Rows.Count).End(xlUp).Row

Dim Found As Boolean

For j = 2 To lrow
Found = False
For i = 2 To drow

CC = wb.Sheets("Input").Range("A" & j)
PP = ws.Sheets("Output").Range("A" & i)
If CC = PP Then
Found = True
wb.Sheets("Input").Range("B" & i & ":" & "I" & i).Copy ws.Sheets("Output").Range("B" & i)

End If


Next
If Found = False Then
ws.Sheets("Output").Rows(j).Insert
wb.Sheets("Input").Range("A" & j & ":" & "I" & j).Copy ws.Sheets("Output").Range("A" & j)
xr = ws.Sheets("Error_Log").Range("A" & Rows.Count).End(xlUp).Row + 1
wb.Sheets("Input").Range("A" & j & ":" & "I" & j).Copy ws.Sheets("Error_Log").Range("A" & xr)




End If

Next

MsgBox "Done", vbInformation, "Completed!!!!"

End Sub


System Configuration: Windows / Chrome 80.0.3987.122

3 replies

Posts
2638
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
August 4, 2020
432
Hi Abdul,

I would like to help you out, but I can't make any sense of your query.

Best regards,
Trowa
1
Thank you

Glad we were able to help! Love us? Write us a review! Rate CCM

CCM 3133 users have said thank you to us this month

Posts
2
Registration date
Thursday March 5, 2020
Status
Member
Last seen
March 5, 2020

if you can give your mail id i will send u the excel file and explain in detail
Posts
2638
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
August 4, 2020
432
Hi Abdul,

I won't do that, but you can upload your file to a free file sharing site and then post the download link here. Always be careful with sensitive data.

Best regards,
Trowa