Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare cell values on different worksheets
Hello,
I´m a newbie to excel VBA programming trying to automate a huge task that is currently being done by hand. I have two worksheets with products that I need to compare. Each product has a code and a product name in the following format: Column A has the product code and column B the product name,for example: ColumnA ColumnD AM1BL15X AGLO MEL BLANCO 1C 15MM 215X244 Both sheets *should* have the same data in them but there are 4000 products that need to have their description verified.So I need to go down each row on Sheet1 , extract the product code from Sheet1.ColumnA and the product name from Sheet1.ColumnD. Then do a search on Sheet2 for the product code (Sheet2.ColumnA) and verify that the product description on sheet2 (Sheet2.ColumnD) is the same as in Sheet1.ColumnD. If it matches,everything is OK. If not there is something wrong. So I´m thinking that maybe the product codes that dont have matching descriptions could be entered in to a separate worksheet so that someone can check it later. I´ve been reading around and found these code samples from this group ( http://tinyurl.com/yuq7eq ): Dim rng1 as Range, i as Long Dim cell as Range With worksheet("Sheet1") set rng1 = .Range(.Cells(1,1),.Cells(1,1).End(xldown)) End With i = 0 for each cell in rng1 if cell.Value < worksheets("Sheet2") .Range("A1").Offset(i,0).Value Then ' do what - they don't match else ' do what - they match End if i = i + 1 Next I´ve been trying to make some changes but I dont quite know how to do the actual code search on Sheet2 to compare the descriptions. If someone has any code snippets to give me a hand I would be very grateful. Thanks! Rafael |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to compare/sort values in two columns of two worksheets? | Excel Discussion (Misc queries) | |||
Excel VBA Macro to compare 2 worksheets for same values | Excel Worksheet Functions | |||
Compare values in 2 worksheets | Excel Programming | |||
Code to compare cell values from different worksheets | Excel Programming |