Excel macro for comparing data

Closed
Sinn - Feb 16, 2011 at 04:08 AM
 Sinn - Feb 22, 2011 at 07:16 PM
Hello,

Here is my problem. See below for example.

(Workbook A)
First name Last name Score
A1 = John B1 = Doe C1 = 4
A2 = Mark B2 = Jones C2 = 3
A3 = John B3 = Bates C3 = 1
(Workbook B)
A1 = John B1 = Bates C1 = blank
A2 = John B2 = Doe C2 = blank

Question: What is the excel macro code/vba code if I want to compare Workbook B to Workbook A? Say, Workbook B A1 matches with Workbook A A1 and A3, then from the result we will then compare Workbook B B1 to Workbook A B1 and B3, it is obvious that the correct match is row 3 of Workbook A. By that, I need to copy Workbook A C3 data and paste it to Workbook B C1 cell. Same goes to Workbook B C2 which I need to paste the data from Workbook A C1.


Thanks in advance


Related:

4 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Feb 18, 2011 at 11:24 AM
are they two different workbook or worksheet.
can you have a column that combine names into one cell, instead of splitting into two ?
0
This problem is solved. Thanks. Someone helped me. I have another problem. How can I copy the cell value and select the entire row which corresponds to it and color it. See sample below.
A1 = 23
A2 = 12
A3 = 5
What I like is that, once cell A1 is selected, the entire row of row23 will be selected and colored. Then the remaining rows until row 25 which are not colored will be hidden. Need your advise. Thanks
0
How did you solve your original problem?
0
I just used the vlookup formula since I never received replies for this using vba. Example, Since from Workbook A, A1 and A3 have the same value but only differs in B1 and B3, I put a unique code for each of them. Meaning, cell D1= 1, D2 = 2, D3 = 3. Then I just do the vlookup referencing column D values to get column C values.
0