I have data in cells A1:A1000. It is a list of names followed by a small note, like this:
They all have "
and a space after the names and then the note. What I am trying to do is delete the everything after the name.
I was playing around with macros to try and do this, but could not get anything to work. Any idea how I might do this?
Press Ctrl + H to open the Find and Replace dialog. In the Find what box, enter one of the following combinations: To eliminate text before a given character, type the character preceded by an asterisk (*char). To remove text after a certain character, type the character followed by an asterisk (char*).
Here is a nifty trick without macros:
Select the proper range (or even just click on A
to select the entire column) and then do Ctrl+F
, click Replace
, in Find
write exactly "*
and leave the Replace with
box empty. Now click Replace all
and tada !
It replaces everything after (and including) the quote with nothing because it uses *
as a wildcard you left the replace box empty.
Edit: As suggested here is the VBA code for this:
Columns("A:A").Replace What:="""*", Replacement:="", LookAt:=xlPart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With