Copy & Paste Entire row if condition Matches

letmein

New member
Joined
Jan 25, 2017
Messages
7
Reaction score
0
Points
0
Location
london
Excel Version(s)
2013
Hello Guys,
I am looking for a macro that will conditionally copy & paste the data
I have a file macro.xlsm & vba macro will be placed in a macro.xlsm & i have one more file sample1.xls (both files are located in different path & the path should be hardcoded in the macro, so that i can change it as per my needs )


We have to copy the data if condition matches. If column B of sample1.xls (sheet1) match with column B of sheet3 of macro.xlsm then compare Column E of sample1.xls(sheet1) with column E of macro.xlsm (sheet3) & If they are different then copy that row from sheet1 of sample1.xls & paste the data to macro.xlsm sheet2
Or
If Column F of sample1.xls(sheet1) differs with column F of macro.xlsm (sheet3) then copy that row of sample1.xls sheet1 and paste it to macro.xlsm (sheet2)






Note: There is a chance of a blank sheet ( may be sample1.xls has a blank sheet1 Or Macro.xlsm sheet3 may be a blank sheet Or Sheet2 of Macro.xlsm may be a blank sheet Or it may have a data)
There is a chance that macro.xlsm may have the same data already which is there in sample1.xls then in that case do not compare that row of sample1.xls sheet1 with macro.xlsm sheet3
Plz see the OutPut sheet


Thnx
 

Attachments

  • Macro.xlsm
    10.5 KB · Views: 13
  • sample1.xls
    26 KB · Views: 9
Back
Top