![]() |
Macros with vlookup
Hi ,
I have two worksheets, sheet1 and sheet2. I need to replace a value i a cell base on the result of the vlookup from another worksheet. Also, base on another vlookup result, I need t delete some roww in the first worksheet. Here is the task that I need to do: 1). I have two worksheets (sheet1 & sheet2) as below: sheet1 ---------- Model Parent Child Qty M1 A1 B1 1 M1 A1 B2 2 M1 B1 C2 3 M1 C2 C3 1 M1 B2 C4 2 M2 A1 B3 3 M2 A1 B4 1 M2 B3 C2 2 M2 C2 C3 3 M2 B4 C5 1 sheet2 ----------- Model oprt ochild nprt Xqty M1 B1 C2 A1 2 M1 C2 C3 A1 3 M2 C2 C3 B3 4 2). What I need to do is replace sheet1.parent with a value fro sheet2.nprt when (sheet1.model & sheet1.parent & sheet1.child) matched (sheet2.model & sheet2.oprt & sheet2.ochild). 3). Second thing that I need to do right after the above is replace sheet1.qty with it own original value time sheet2.xqty when when (sheet1.model & sheet1.parent & sheet1.child) matched (sheet2.model & sheet2.oprt & sheet2.ochild). (you can combine with the above when replacing sheet1.parent, it's th same condition) 4). I will then need to remove whichever row in sheet1 when the ne result after (2) &(3)- (sheet1.model & sheet1.parent & sheet1.child matched with (sheet2.model & sheet2.nprt & sheet2.ochild). After running the macros the result of sheet1 will look like this : Sheet1 -------------- Model Parent Child Qty M1 A1 B2 2 M1 A1 C3 3 M1 B2 C4 2 M2 A1 B3 3 M2 A1 B4 1 M2 B3 C3 12 M2 B4 C5 1 Attached is my Excel file for your reference. Thanks in advance for your help. Warmest sincere best regards, Achon Attachment filename: sample.xls Download attachment: http://www.excelforum.com/attachment.php?postid=63293 -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 03:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com