VBA to delete text based on defined start and end text

Newsbee

New Member
Joined
Feb 17, 2013
Messages
8
Hello Community!

I come to you again in my hour of need. I have a task to update roughly 30,000 medical consent forms in Excel. I have been putting together scripts to automate the process, but I am stuck. I need a script that I can give it a couple of words to start a search and then a couple to stop and delete any text in the middle. Like the following:

[FONT=&quot]We the People of the United States, in Order to form a more perfect Union, establish Justice, insure [/FONT]domestic Tranquility[FONT=&quot], provide for the common [/FONT]defence[FONT=&quot], promote the general [/FONT]Welfare[FONT=&quot], and secure the Blessings of Liberty to ourselves and our [/FONT]Posterity[FONT=&quot], do [/FONT]ordain[FONT=&quot] and establish this Constitution for the United States of America.

Beginning text: We the People
End text: United States of America

Delete everything... beginning text, middle, and end.

I apologize if this is in another post. I have been searching online for 2 hours now. Thanks![/FONT]
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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