+ Reply to Thread
Results 1 to 27 of 27

How to highlight certain keywords that I search.

  1. #1
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    How to highlight certain keywords that I search.

    Sorry if this has been answered before, trying to look through these forums is giving me carpal tunnel.

    I am trying to be able to highlight and then delete every keyword that I can search in my excel file.

    For Example in the picture I attached, I want to be able to get rid of any that say LLC, Trust and Company.

    Thank You.
    Attached Images Attached Images

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: How to highlight certain keywords that I search.

    What options are you considering? If you simple apply a filter to the column and then filter with "contain" and put in LLC and all those with LLC will come up.
    you can use a search in the next column to find LLC or Trust or Company and put something in that column then filter on those then delete.
    You can do a find and replace, find what >> LLC replace with >> leave blank but this will only remove LLC from a cell leaving the rest in place.
    You cannot use a formula to delete things, that can only be done with VBA (a different section of this forum) and if that is what you want you might want to private message a moderator or administrator asking to move this post to the VBA forum.
    So what is it you are looking to do, just get rid of LLC from a cell or get rid of the whole cell?
    Lastly, check the yellow banner at the top of the post and upload a small representative sample WITH expected results and which way you'd like it done.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    I would like to search for any that say LLC, Trust, or Company and delete the entire column. I can post this in a VBA forum if that's easier.

    Thank You
    Attached Files Attached Files

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: How to highlight certain keywords that I search.

    columns go up and down and are column A and B etc.
    rows go across. If you don't want to do it by formula and filter see the attached sample. I added a formula in a helper column G with examples I highlighted in yellow.
    this formula in G
    =IF(ISNUMBER(SEARCH("LLC",F2))=TRUE,"Delete",IF(ISNUMBER(SEARCH("company",F2)),"Delete",IF(ISNUMBER(SEARCH("trust",F2)),"Delete","")))
    To get VBA you'll need to message a moderator and ask it to be moved.
    I do not have VBA skills.
    to use what I've attached, just filter on "Delete" in column G you can sort on that column moving those to either the top or bottom and then delete them in a batch.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    Paste this code in to a Macro Module and Run the Macro "Test"


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 02-21-2020 at 04:14 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to highlight certain keywords that I search.

    If you are able to answer the questions that were posted in your other duplicate thread which has now been closed by the Moderator, we may be able to help.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  7. #7
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    To be able to use that in my larger Excel files, would I just copy and paste it in the same section as shown in the one you did?

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    If you are asking me. Then yes. As long as you have a max of 6 columns of data.

    You can have as many rows as you want.

    If you want more, or a variable number of columns.

    Then please let me know.

  9. #9
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    mehmetcik Sorry about that, I didn't see all the new posts. I was replying to the original poster who responded.

    I opened your attachment and ran it. After it says "Run-time error '1004': No cells were found."

  10. #10
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    Yes I am just trying to delete the rows. If this info helps, I am downloading lists and then need to find and delete all the duplicates. Then second delete all the LLC's and names like Trust and Properties.

  11. #11
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    To Sambo Kid

    To be able to use that in my larger Excel files, would I just copy and paste it in the same section as shown in the one you did?
    I tried to do just that and it didn't work for me.

  12. #12
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    I get that message if I click on the button twice. ie if I run the macro twice.

    Please try again.


    Alternatively. This version has some error trapping.


    NB this part of the code is your list of items to delete:
    Please Login or Register  to view this content.
    So you need to change that to
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 02-21-2020 at 05:17 PM.

  13. #13
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    - Mehmetcik

    I tried it again like you said and am getting the same response.

    I just downloaded the second you you just sent and it doesn't seem like anything is happening.

    To be absolutely clear, I downloaded each file you sent me and tried it in that file. Not my other excel files.
    In your first post you said to paste it into a macro module.. I don't know how to do that.

  14. #14
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: How to highlight certain keywords that I search.

    @newbie, (Post #11) it worked for me in the sample workbook you posted, to repoint it to different cells just make the adjustments to the formula, you can see it in what I reposted which was just your data. When you say it doesn't work for you, more details would be helpful. Maybe a sample showing where you are using it and what it is pointed to so I can see why it isn't working. (that is if you aren't using mehmetcik's solution.)

  15. #15
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    Hi.

    Ok I am attaching a sample workbook.

    I have highlighted two rows that need to be deleted.

    Open the workbook. You will need to enable editing and also macros.

    Once open. Check that you agree which two rows need to be deleted.

    Then click on the button in cell. I3.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    -mehmetcik

    It works! I'm speechless.

  17. #17
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    -mehmetick

    To be able to do this to my other files, would I just follow your instructions before and paste that code into a macro module?
    Or did you change it up and would I have to do something different?

    Thank you for help and I'm sorry about the late reply.

  18. #18
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    This works for column A of any file.

    If you want to use it for multiple files then you should place it into your Personal Workbook.

    This is a bit complicated but worth doing.

    I will talk you through the simplest way to do this.

    To start with decide on a short cut to start the macro. Lets go for Ctrl z.

    So whenever you type Ctrl z. the macro will run.

    Next Select the Developer tab and Select "Record Macro"

    Enter this data into the window that opens.

    Macro Name: TidyUp
    Shortcut Key: z
    Store Macro in: Personal Macro Module
    Description: Delete Text: Properties, LLC

    Select Ok to start the macro recorder. Excel will now record all your keypresses. This is the easiest way to start creating a Macro.

    Next Select the Developer tab and Select "Stop Recorder"


    Next Select the Developer tab and Select "Macros" Select "TidyUp" and then "Step Into"

    You Should see a Short Macro.

    Paste your Macro inside this Macro. Remembering to delete the first and last lines of your original macro.

    Now very carefully. Close the macro module.

    very carefully. Close Excel using the close button on the top right of Excel. MAKE SURE you Select "SAVE CHANGES TO PERSONAL MACRO"

    Now open any excel workbook

    Select any sheet with text in Column A. Press Ctrl z.
    Last edited by mehmetcik; 02-24-2020 at 03:41 PM.

  19. #19
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    - mehmetcik

    I am on the "Paste your Macro inside this Macro. Remembering to delete the first and last lines of your original macro." step, and just want to clarify what you mean by it.
    Here's a picture of what my screen looks like.
    Attached Images Attached Images

  20. #20
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    -mehmetcik

    I've tried this a few different ways and I think I have gotten farther, but now I am getting a "Run-time error '28': Out of Stack Space".

  21. #21
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    Did you manage to find your personal workbook?

    Try Deleting your temporary Macro.

    Then paste this code in the personal workbook, Close the module and close excel. Remember to save changes to the Personal workbook.

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 02-26-2020 at 01:09 PM.

  22. #22
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    Yes I believe so. I had an error come up that said to edit my macro I had to "unhide it" if that is what you mean.

  23. #23
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    I am getting an error that says Compile Error: Expected End sub.

  24. #24
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    Delete everything in the personal workbook and try again

    My code has one sub and it ends with end sub.


    Please Login or Register  to view this content.
    Last edited by mehmetcik; 02-26-2020 at 02:06 PM.

  25. #25
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    When I run the macro in my personal workbook, I think it works. #NAME? comes up in in column G in 8 rows.

    When I try to run it in any other file though, it doesn't seem to be working.

  26. #26
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight certain keywords that I search.

    Ok I have spent hours on this.

    Read this link:

    https://www.myonlinetraininghub.com/...-xlsb-workbook

    Although you can run macros on your personal workbook. Microsoft have made changes that mean it is difficult/impossible to run functions on the personal workbook.

    I tried to get this working here so I could talk you through it and failed.

    However I am stubborn and will keep trying.

  27. #27
    Registered User
    Join Date
    02-21-2020
    Location
    USA
    MS-Off Ver
    2007
    Posts
    16

    Re: How to highlight certain keywords that I search.

    You are persistent and unshakable my friend! Stubborn has such a bad connotation.

    I am truly grateful for all of your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Search Keywords and Delete Every Line Except Keywords
    By area51plustax in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-16-2018, 12:30 PM
  2. How to Highlight or Remove Based on Many Keywords
    By NYCData in forum Excel General
    Replies: 2
    Last Post: 10-19-2017, 05:25 AM
  3. [SOLVED] highlight keywords in a list when they occur in a string on another sheet
    By 180drop in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-16-2015, 05:17 PM
  4. VBA Code to search keywords, then highlight when found
    By koz81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2014, 05:52 PM
  5. [SOLVED] Search for keywords and copy rows containing keywords to new sheet
    By lenorsk in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-15-2013, 06:54 AM
  6. Search range of strings with a range of keywords and highlight matches
    By efillner in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2013, 04:07 PM
  7. [SOLVED] Macro to highlight keywords-Macrobutton not working fine
    By Awalgaonkar in forum Word Formatting & General
    Replies: 2
    Last Post: 03-27-2013, 08:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1