Find, remove matching text from string

Jeff P

Board Regular
Joined
Jun 11, 2011
Messages
80
In column C, i have a Text string spanning several hundred rows.
In columns ("H:M") are a list of names, that are repeated down.

I'm in need of a VBA script that will search through the text string, for key words from ("H:M") and remove all except those matching words.

As an example to go from this.

C ........................................................... H..... I..... J....K.....L....M
Bob and Mary, went to a dinner party...........Bob Fred Mary John Tim Sam
Sam met with John...................................Bob Fred Mary John Tim Sam

to this:

C........................................................... H..... I..... J....K.....L....M
Bob and Mary, went to a dinner party...........Bob Fred Mary
Sam met with John...................................Bob Fred Mary John Tim Sam


Thanks for any help!

Jeff
 
.. the first letter of each name in the Header was capitalized, which also reflected in their corresponding column throughout. For cosmetic purposes this would be great, ..
Then try adjusting this line in my code

Rich (BB code):
b(i, d(CStr(mtch))) = Application.Proper(mtch)
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,377
Messages
6,119,183
Members
448,872
Latest member
lcaw

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