Need a macro to match and copy
Hi.
Currently, I have two workbooks and I need to copy data from one workbook to another using macro. First of all, I need to match data from 2 columns before copying the data from workbook2 to workbook1. Attached is a sample of the workbook. Please help.
Attachment | Size |
---|---|
Book1.xlsm | 7.76 KB |
Book2.xlsx | 7.84 KB |
Hi, hoping it's not too late
Hi, hoping it's not too late to answer your question ;)
I've studied your workbooks and you may not need a macro to solve your task. In cell D2 of WorkBook1, Sheet1, I used the following function:
=INDEX([Book2_0.xlsx]Sheet1!$C$2:$C$10;MATCH(1;INDEX(($B$2:$B$10=B2)*($C$2:$C$10=C2););0))
assuming that in cells range C2:C10 of Sheet1 in Book2 you have the data that you need to match/copy in cells range D2:D10 of Sheet1 in Book1.
It worked for me and should work for you as well. Please let me know if it's the right solution for you!