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 :confused: :confused:](/styles/default/custom/smilies/confused.gif)
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.....
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 :confused: :confused:](/styles/default/custom/smilies/confused.gif)
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.....