VBA to find/replace information from one sheet to another

dominikapabis

New Member
Joined
Feb 9, 2016
Messages
4
Hello,

I am looking for help on writing a VBA that will replace information in one sheet using a legend that is in another sheet.

I need two things to happen.
1. replace cells in column C in Sheet1 with data from column C in Sheet2 if column C in Sheet1 = column A in Sheet2.
2. also insert the adjacent cell (Item Number) that corresponds with the new description.

Here is a simple sample of the spreadsheet.

Sheet 1 BEFORE Code:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]EQUIPMENT TYPE[/TD]
[TD="align: center"]ITEM NUMBER[/TD]
[TD="align: center"]DESCRIPTION[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Actives [/TD]
[TD="align: center"][/TD]
[TD="align: center"]NC400[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Full Spectrum EQ- Bank 1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]T2&4 CS12
[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]T2&4 CS09[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Full Spectrum EQ - Bank 2[/TD]
[TD="align: center"][/TD]
[TD="align: center"]T8 CS09
[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]T8 CS06[/TD]
[/TR]
</tbody>[/TABLE]


Sheet 2 (KEY)
[TABLE="width: 500"]
<tbody>[TR]
[TD]1
[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD="align: center"]Original Description[/TD]
[TD="align: center"]Item Number[/TD]
[TD="align: center"]New Description[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]
NC400​
[/TD]
[TD]5543
[/TD]
[TD]Full Features 2x2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]
T2&4 CS12​
[/TD]
[TD]5568[/TD]
[TD]Cable Simulator 12db
[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]
T2&4 CS09​
[/TD]
[TD]9956[/TD]
[TD]Cable Simulator 9db
[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]
T8 CS09​
[/TD]
[TD]5547[/TD]
[TD]Return Path 9db[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]
T8 CS06​
[/TD]
[TD]6689[/TD]
[TD]Return Path 6db[/TD]
[/TR]
</tbody>[/TABLE]


Sheet 1 AFTER CODE:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]EQUIPMENT TYPE[/TD]
[TD="align: center"]ITEM NUMBER[/TD]
[TD="align: center"]DESCRIPTION[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Actives [/TD]
[TD="align: center"]5543[/TD]
[TD="align: center"]Full Features 2x2[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Full Spectrum EQ- Bank 1[/TD]
[TD="align: center"]5568[/TD]
[TD="align: center"]Cable Simulator 12db[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"][/TD]
[TD="align: center"]9956
[/TD]
[TD="align: center"]Cable Simulator 9db[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Full Spectrum EQ - Bank 2[/TD]
[TD="align: center"]5547[/TD]
[TD="align: center"]Return Path 9db[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"][/TD]
[TD="align: center"]6689[/TD]
[TD="align: center"]Return Path 6db[/TD]
[/TR]
</tbody>[/TABLE]


I know that I will have to use a series of loops, I would appreciate any help.

Thanks!`
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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