Macro to locate records in Tab A and paste corresponding value in Tab B

sncb

Board Regular
Joined
Mar 17, 2011
Messages
168
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi All,

Im working on 2 tabs where I need the macro code to locate records on Tab 'Ending' and paste the 3rd value beside the corresponding record in Tab 'Run'

Eg:

The macro must search for 'ST' AND '12345' in Tab 'Ending'

Excel Workbook
ABC
1PO TypePO NumberSales Person
2ST12345James
3ST45677Tony
4UN22222Franz
Tab 'Ending'


and in Tab 'Run' must find the corresponding 'ST' and '12345' and paste James in cell C2

Excel Workbook
ABC
1PO TypePO NumberSales Person
2ST12345*
3ST45677*
4UN22222*
Tab 'Run'


Thanks for anyone who can assist.

B Regards
 
Hi Jreedich, shg and TusharM,

First of all very sorry for the delay in replying as I was off this whole week. Yes both the macro and the excel solution worked as well.

Although I wont be using the excel solution for this particular problem, I had another issue where the excel was the exact solution I needed, so Thanks to all of you.

However, I don't want to hijack this thread but if possible I need the macro to do the following:

Currently I have data pasted in my excel sheet as below in a tab called 'codes':


Excel Workbook
ABCD
1DEUTSCHLAND
2WarehouseCodeDateItem ID
3WH-5142ABB14/3/11M4600
4WH-5142ABB14/3/11M4600
5WH-5142MNC14/3/11G6500
6WH-5142MNC14/3/11G6500
7WH-5142MNC14/3/11G6500
8WH-5142RGV14/3/11R5566
9WH-5142RGV14/3/11R5566
10FRANCE
11WarehouseCodeDateItem ID
12WH-9197ABB14/3/11M4600
13WH-9197ABB14/3/11M4600
14WH-9197MNC14/3/11G6500
15WH-9197MNC14/3/11G6500
16WH-9197MNC14/3/11G6500
17WH-9197RGV14/3/11R5566
18WH-9197RGV14/3/11R5566
codes



and many more countries under DE and FR and would like to change it to look like this below in tab called 'changed':


Excel Workbook
ABCDE
1WarehouseCodeDateItem ID
2DEUTSCHLANDWH-5142ABB14/3/11M4600
3DEUTSCHLANDWH-5142ABB14/3/11M4600
4DEUTSCHLANDWH-5142MNC14/3/11G6500
5DEUTSCHLANDWH-5142MNC14/3/11G6500
6DEUTSCHLANDWH-5142MNC14/3/11G6500
7DEUTSCHLANDWH-5142RGV14/3/11R5566
8DEUTSCHLANDWH-5142RGV14/3/11R5566
9
10WarehouseCodeDateItem ID
11FRANCEWH-9197ABB14/3/11M4600
12FRANCEWH-9197ABB14/3/11M4600
13FRANCEWH-9197MNC14/3/11G6500
14FRANCEWH-9197MNC14/3/11G6500
15FRANCEWH-9197MNC14/3/11G6500
16FRANCEWH-9197RGV14/3/11R5566
17FRANCEWH-9197RGV14/3/11R5566
changed




B Regards
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

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