LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Search and Compare two Workbooks

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with formula to search and compare data in different col Michael Excel Worksheet Functions 4 April 7th 09 02:39 AM
Compare workbooks Andy Excel Discussion (Misc queries) 11 April 5th 09 11:46 PM
Search / Compare / Copy Value Up (cpm) sandy_eggo Excel Discussion (Misc queries) 1 February 11th 09 05:27 PM
Compare workbooks Scafidel Excel Discussion (Misc queries) 2 May 28th 07 09:15 PM
compare different workbooks kjstec Excel Worksheet Functions 1 October 17th 06 06:34 PM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"