D
DireWolf
I want to run a macro to search through one workbook and find the
corresponding entry in another work book and enter the row details in
a new workbook if one of the other cells in the row does not match.
The real data I have is two product price lists.
So I want to be able to through through column A which has the product
code in the first worksheet and find the matching product code in the
second.
Once a match is found I want to check the corresponding row for Column
B which has the price. If there is any difference I want to have the
row from the first workbook copied and pasted into a new workbook.
This will give me a list of products that have a change in price.
Also if there is not a matching product code I want to also copy that
row into a third workbook on a different sheet. Plus reverse the
seach from the second workbook to the first. What this will do is
give me a list of new products and a list of old (obsolete) products.
Here is what I think I'm after in persudo code
WB1 = workbook1
WB1A = workbook1, column A
WB1B == workbook1, column B
WB2 = workbook2
WB1A = workbook2, column A
WB1B == workbook2, column B
WB3 = workbook3
WB3price_change = workbook3, worksheet 'price_change'
WB3new_product == workbook3, workshhet 'new_product'
WB3old_product == workbook3, workshhet 'old_product'
while WB1A is not empty
search WB1A
find matching row in WB2A
if WB1B = WB2B continue
if WB1B != WB2B
then copy row WB1A
Paste into WB3price_change
if WB1A finds no match in WB2A
then copy row WB1A
Paste into WB3new_product
goto start
while WB2A is not empty
search WB2A
find matching row in WB1A
if match found, continue
if WB2A finds no match in WB1A
then copy row WB2A
paste into WB3old_product
goto start
corresponding entry in another work book and enter the row details in
a new workbook if one of the other cells in the row does not match.
The real data I have is two product price lists.
So I want to be able to through through column A which has the product
code in the first worksheet and find the matching product code in the
second.
Once a match is found I want to check the corresponding row for Column
B which has the price. If there is any difference I want to have the
row from the first workbook copied and pasted into a new workbook.
This will give me a list of products that have a change in price.
Also if there is not a matching product code I want to also copy that
row into a third workbook on a different sheet. Plus reverse the
seach from the second workbook to the first. What this will do is
give me a list of new products and a list of old (obsolete) products.
Here is what I think I'm after in persudo code
WB1 = workbook1
WB1A = workbook1, column A
WB1B == workbook1, column B
WB2 = workbook2
WB1A = workbook2, column A
WB1B == workbook2, column B
WB3 = workbook3
WB3price_change = workbook3, worksheet 'price_change'
WB3new_product == workbook3, workshhet 'new_product'
WB3old_product == workbook3, workshhet 'old_product'
while WB1A is not empty
search WB1A
find matching row in WB2A
if WB1B = WB2B continue
if WB1B != WB2B
then copy row WB1A
Paste into WB3price_change
if WB1A finds no match in WB2A
then copy row WB1A
Paste into WB3new_product
goto start
while WB2A is not empty
search WB2A
find matching row in WB1A
if match found, continue
if WB2A finds no match in WB1A
then copy row WB2A
paste into WB3old_product
goto start