Find and delete

Lara465

New Member
Joined
Mar 29, 2020
Messages
32
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello!
Is it possible to find a part of a word and delete it ? I have a column like :

LaviniaAdm as exp
AndreeaAdm not there
LauraAdm adminansdghjk
.
.
.
And so on. A name followed by Adm written together. I have a long list so I don't want to delete it manually. Is there a way to insert a space before the "Adm" and then I know hot to delete it or to delete everything after the "Adm"?



Thanks a lot!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
If I understood you well, try Find / Replace

findreplace.png
 
Upvote 0
Yes, it works to replace the word. But is there a way to delete everything from that word on?

Dim r As Long, HSindex As Long

lstR = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

For r = 1 To lstR

With ThisWorkbook.ActiveSheet

HSindex = InStr(.Range("A" & r).Value, "Adm")

If HSindex > 1 Then

.Range("A" & r).Value = Left(.Range("A" & r).Value, HSindex - 1)


End If
End With
Next r

I found this, to delete everything from that word on. But I need to add a space before Adm for it to be considered a word. So if I replace it doesn't solve my problem.
 
Upvote 0
I found the answear. I use find and replace it with the same word but with a space before and then use the code I wrote before here. Thanks.
 
Upvote 0
I apologize for not understanding well.
This below deletes the entire text starting with 'Adm'. Only the name remains.
The result is the same as starting your VBA.
Regardless, I hope you solved your problem.
regards

[EDIT]: OK, I see you've solved it
 

Attachments

  • findreplace2.png
    findreplace2.png
    3.6 KB · Views: 11
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,099
Members
452,379
Latest member
IainTru

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