Excel - macro or vba code?

patty123467

New Member
Joined
Jul 24, 2015
Messages
44
How can I create a code that will compare sheets and replace another column when there is a unique identifier found. Sheet 1 and 2, column A will contain a unique ID but they wont be in the same order. Sheet 1 and 2 will have column B containing non-unique data. I need for sheet 1 column B to be replaced with the text in sheet 2 column b when there is a unique ID found in column a on sheets 1 and 2. See below example.

Sheet 1</SPAN>

[TABLE="width: 128"]
<TBODY>[TR]
[TD]Test1</SPAN></SPAN>
[/TD]
[TD]Test2</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]z123</SPAN></SPAN>
[/TD]
[TD]apple </SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]z1234</SPAN></SPAN>
[/TD]
[TD]pear</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]z12345</SPAN></SPAN>
[/TD]
[TD]banana </SPAN></SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]

Sheet 2</SPAN>
[TABLE="width: 128"]
<TBODY>[TR]
[TD]Test1</SPAN></SPAN>
[/TD]
[TD]Test2</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]z1234</SPAN></SPAN>
[/TD]
[TD]red</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]z123</SPAN></SPAN>
[/TD]
[TD]blue</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]z12345</SPAN></SPAN>
[/TD]
[TD]yellow</SPAN></SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]

Apple would change to blue</SPAN>
Pear would change to red</SPAN>
banana would change to yellow</SPAN>
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top