Delete Text that is entered in TextBox

  • [xpost][/xpost]


    I have been doing macro recently (just a newbie) and I need a functionality that, I have a TextBox (ActiveX) and when I enter a specific text to that text box, the text or word (not the rows or columns) will be deleted in active sheet. Please help. Thank you in advance.

  • Why do you need a TextBox or even VBA? You can simply use Find and Replace.

    Hello, yes, I just realized that. But maybe I was not able to state my objectives thoroughly. Here how it goes:

    Just a particular text in column will be deleted and not the entire row. Example in Column G, columns have this:

    HERR-101, HERG-789, HERT-789

    Only the "HERR-101" will be deleted and will retain "HERG-789", "HERT-789". The number after "HERR" is also changing so I am thinking of just using "HERR-".

    I got this in web but it looks like the entire column is deleting, maybe you can help on this please. Thank you.

  • ... which you should, out of courtesy, share here. Please do this NOW.

    Ali :)

    Enthusiastic self-taught user of MS Excel who's always learning!
    If anyone has helped you towards solving a problem, then you can thank them by clicking on the like icon bottom right.

    :!:Forum Rules

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post

    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.

    How to use code tags

    Just highlight all of the code and press the <> in the post menu above button to add the code tags.


    Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the URL from the address bar in your browser) to the cross-post. We are here to help so help us help you!

    Read this to understand why we ask you to do this

    It's good that received a solution. To close this thread, please either add your answer and accept it as an answer: this could help others or you might get a better answer.

    Three rules broken, not a good start!!. READ THE FORUM RULES BEFORE POSTING AGAIN - you will find that all Excel Forums have similar rules.

  • Hi,

    This was the solution:

  • I would suggest that you simply need Find & Replace manually or in VBA. It's hard to say without seeing an example of the worksheet.

    I've edited your last post to make it readable, I don't know why it wasn't before.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!