VBA script to delete Text after dates

NeoSez

Board Regular
Joined
Aug 14, 2020
Messages
210
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Would like to delete some useless system text in a column, but not all the text in the cell. Each cell will have date entries. Would like to delete the useless text and the date preceding it. Each date is on a separate line within the cell.
So far, I have the delete text part down, but it doesn't include the date.

Example:
jan 1, 2023 text 1
dec 31, 2022 useless text 123
dec 11, 2022 text 3
dec 3, 2022 useless text 456
 
Hi NeoSez,

I am not sure I completely understand what you are looking to do. Could you provide an example of what is in the cell before and after you run the code? Is it changing the cell's contents or writing the results to a new cell? Would the phrase you want to find (ie. "My dog has fleas") be in a separate cell?
 
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,215,473
Messages
6,125,020
Members
449,203
Latest member
tungnmqn90

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