Replace cell data for a column based on the value of the next cell for another column

tubrak

Board Regular
Joined
May 30, 2021
Messages
216
Office Version
  1. 2019
Platform
  1. Windows
Hello
I need macro for about 1000 rows to replace any unmatched items in column B for two sheets(sheet1,2) with matched items sheet MAIN, but when replace the items umatching with items into column B into cells for two sheets(sheet1,2) depends on corresponding cell into column B for the same cell for two sheets(sheet1,2) .
for instance if the items in sheet1,2 for cell B2 unmatched with cell B2 in sheet MAIN then should replace based on sheet main for the same cell B2 corresponding cell into column B and the same thing for the others cells .
SHEET MAIN
CL.xlsm
AB
1S.NITEM
21TR 200M45MM LK H K/L
32TTR 12200S45 MN 123
43TR 1425/148V MN 123H K/L
54TR 200M45 MM 123H K/L SS
65TR 2.5M100* 123H K/L
76TR 2.5M100**123H K/L
87CTR 12-200M45 MM 123H K/L
MAIN


sheet1
CL.xlsm
ABC
1S.NITEMQUANTITY
21TR 200M451NMM LK H K/L12
32TTR 12200S45 MN 123411
43TR 1425/148V MN 123HH K/L10
54TR 200M45 MM 123H K/L SS20
65TR 2.5M100**123H K/L25
76TR 2.5M100**123H K/LM30
87CCTR 12-200M45 MM 123H K/L20
SHEET1



sheet2
CL.xlsm
ABC
1S.NITEMQUANTITY
21TR 1200M45MM LK H K/L20
32TTRR 1200S45 MN 12310
43TR 1425/148V MN 123H K/L11
54TR 200M45 MM 123H K/L SS12
65TR 22.5M100* 123H K/L13
76TR 2.5M1100**123H K/L14
SHEET2


result
sheet1
CL.xlsm
ABC
1S.NITEMQUANTITY
21TR 200M45MM LK H K/L12
32TTR 12200S45 MN 12311
43TR 1425/148V MN 123H K/L10
54TR 200M45 MM 123H K/L SS20
65TR 2.5M100* 123H K/L25
76TR 2.5M100**123H K/L30
87CTR 12-200M45 MM 123H K/L20
SHEET1


sheet2
CL.xlsm
ABC
1S.NITEMQUANTITY
21TR 200M45MM LK H K/L20
32TTR 12200S45 MN 12310
43TR 1425/148V MN 123H K/L11
54TR 200M45 MM 123H K/L SS12
65TR 2.5M100* 123H K/L13
76TR 2.5M100**123H K/L14
SHEET2

thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,216,102
Messages
6,128,846
Members
449,471
Latest member
lachbee

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