Compare names in two different worksheets

E

excelnewbie

Hello,

Need help desperately! To simplify...

Sheet1 is made up of two columns:
Column A is Last Name
Column B is First Name

Sheet2 is made up of two columns:
Column A is Last Name
Column B is First Name

I need to write code that will compare Sheet1 Column A to Sheet 2
ColumnA and if there is a match then compare Sheet1 Column B to Sheet 2
Column B to make sure it is the same Last Name and First Name (same
row), then write the name next to any matches....and I don't want to
concatenate the cells. :confused:

My current code is looking for matches not taking into consideration
that the Last Name and First Name might not be on the same row for ex.

Set CompareRange = Workbooks("Names.xls"). _
Worksheets("Sheet2").Range("B3:B3800,C3:C3800")
For Each x In Selection
For Each y In CompareRange
If x = y Then x.Offset(0, 4) = x
Next y
Next x

If I have Smith Joe in Sheet 1 and in Sheet 2 I have a Smith Bob and a
Johnson Joe it will show up as if if found Smith Joe because it isn't
putting looking at them together??? I hope that makes sense.....
 
E

excelnewbie

Thank You soooo much Tom!!! It worked perfectly!!! You were right about
my ranges...I was in such a hurry in just trying to simplify my code
that I forgot to change that!

Thanks a million!! :D :D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top