PC Review


Reply
Thread Tools Rate Thread

Compare cell values on different worksheets

 
 
kektex
Guest
Posts: n/a
 
      15th Feb 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to compare/sort values in two columns of two worksheets? pemt Microsoft Excel Misc 4 21st Jan 2009 10:22 PM
compare multiple values in one cell to a range of values in multiplecells? hfx.selling Microsoft Excel Worksheet Functions 4 1st Nov 2008 09:01 PM
Excel VBA Macro to compare 2 worksheets for same values fiona.burke@esb.ie Microsoft Excel Worksheet Functions 0 23rd Aug 2006 04:35 PM
Code to compare cell values from different worksheets =?Utf-8?B?RWQgUA==?= Microsoft Excel Programming 1 18th Feb 2005 03:26 PM
Compare values on different worksheets Matt Microsoft Excel Worksheet Functions 1 7th Jan 2004 03:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:33 PM.