Find word/s in a cell or column and paste the value to another cell.

ac0510

New Member
Joined
Oct 24, 2018
Messages
1
Hi experts! I'm posting this thread hoping for an answer to my not-so-complicated requirement in excel. I was browsing through the web and came across MrExcel and found most of the relevant threads from here.

I need a macro/VBA in excel where I can find and extract word/s from a cell or column and paste them to another cell whether in the same sheet or another.

Here's a sample scenario.

Sentences splitted into many line breaks will be pasted to Column A, so here's what is going to look like.
[TABLE="class: outer_border, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Column C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]This is a sample message.[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]John Smith[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]AB 123 CDE FGH[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]AB Apple[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]CDE Dog[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]FGH Cat[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]










I need to paste the words to Column C to arrange them properly with Column B as the corresponding field names.
[TABLE="class: outer_border, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Column C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]This is a sample message.[/TD]
[TD]Name:[/TD]
[TD]John Smith[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]John Smith[/TD]
[TD]Blood:[/TD]
[TD]AB[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]AB 34 CDE FGH[/TD]
[TD]Age:[/TD]
[TD]34[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]AB Apple[/TD]
[TD]Fruit:[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]CDE Dog[/TD]
[TD]Pet1:[/TD]
[TD]Dog[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]FGH Cat[/TD]
[TD]Pet2:[/TD]
[TD]Cat[/TD]
[/TR]
</tbody>[/TABLE]










In the above table, we assumed that the 2nd row is the Name, while the 3rd is the blood type followed by the age.

I would also appreciate if you can guide me in creating macro statements like in the table above, the CDE (which means Dog in the example) is present in Column A, therefor, Pet1 is generated as Dog instead of CDE. Same goes with the FGH/Cat.

Guys, I really hope you could help me with this macro. I would greatly ease up our daily process of segregating data in Excel.

Thank you in advance!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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