• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Remove Text to the Right

dparteka

Member
Sheet-1 Column-A has various text that looks somewhat like this...

.0051 Total Runout to -A- -B- [Actual] 1-3H12-39

Each field has a left square bracket as shown above to the left of the word Actual, I've been trying to create a macro that will remove everything to the right of that bracket in all the cells in column-A; I appreciate any help you can offer... thank-you
 
A wildcard is your friend. :cool:
Code:
Sub KillBracket()
Range("A:A").Replace what:="[*", replacement:="", lookat:=xlPart
End Sub
 
Try this formula if the text is in Cell A1:

=LEFT(A1,FIND(" [",A1))

Or if you want to keep the left bracket:
=LEFT(A1,FIND("[",A1))
 
Don't mind Mr. Grumpy-pants there, cdbauer1. He's just jealous that I got the solution first. ;) j/k
While OP did request a macro, it's nice to see a formula solution, just in case OP had not considered it.
 
Ha! I did see that before responding, @SirJB7 - but I also believe:
“Success is about having more options. More the options, more the success.”
-Krishna Saagar

I'd also hope to enrich the options of the next person to come across this very aptly named thread.
 
Back
Top