+ Reply to Thread
Results 1 to 9 of 9

Deleting Rows where multiple words are found

  1. #1
    Registered User
    Join Date
    10-08-2014
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Deleting Rows where multiple words are found

    Hey All,

    I'm running into some trouble creating a macro to delete rows when a word from a blacklist is found. In a column, I have multiple descriptions of items. These descriptions are lengthy and I have "trigger words" that would let me know they are not applicable in the situation. There are multiple trigger words, so I would like to use a blacklist that would look for these trigger words in the description and if it contains any of the words, delete the row. Any help is much appreciated.

    Thank you!

    EDIT: Column K is the column where descriptions are.
    Trigger words are: "studio" "postage" "post it" "label"
    Last edited by ScottyZ92; 10-09-2015 at 10:47 AM.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Deleting Rows where multiple words are found

    Perhaps having the blacklisted words in an array and then using autofilter to find the rows with blacklisted words and delete them in one go.

    Depends a bit on the number of blacklisted word and if there could be more than one column where the words could be found.

    Just read your description oh the problem and that should work very well using autofilter.

    Alf
    Last edited by Alf; 10-09-2015 at 10:54 AM.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Deleting Rows where multiple words are found

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-08-2014
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Deleting Rows where multiple words are found

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    Would that work for plurals of words as well, i.e. "labels?" And this searches the entire string of text in the cell for these words, correct? Sorry, just very new to VBA.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Deleting Rows where multiple words are found

    Should work for plurals. And yes if a string in Column K contains the word or plural it should delete the entirerow.

  6. #6
    Registered User
    Join Date
    10-08-2014
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Deleting Rows where multiple words are found

    Quote Originally Posted by JOHN H. DAVIS View Post
    Should work for plurals. And yes if a string in Column K contains the word or plural it should delete the entirerow.
    It doesn't seem to be removing plurals or words that are all caps or start with a capital. Any ideas on how to fix this?

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Deleting Rows where multiple words are found

    Try adding Option Compare Text above the code

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-08-2014
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Deleting Rows where multiple words are found

    Quote Originally Posted by JOHN H. DAVIS View Post
    Try adding Option Compare Text above the code

    Please Login or Register  to view this content.
    Worked like a charm! You're the man!

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Deleting Rows where multiple words are found

    Glad to hear it worked for you. And thanks for the feedback. Please comply with Forum Rules and mark this thread as SOLVED. See link below for guidance.

    http://www.excelforum.com/forum-rule...rum-rules.html

+ 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. how can i copy/paste the word which is found during search in the current row wise
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2014, 02:55 AM
  2. Having an issue deleting rows based on certain text found in them...
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-04-2014, 05:07 AM
  3. Macro to delete multiple rows below that that is found
    By andy.k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2013, 07:45 PM
  4. Macro - deleting rows if no image found on server
    By DeanR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-04-2013, 11:02 AM
  5. Using "Find" to return results if a word is found within multiple words in a cell
    By pylauzier in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2011, 01:37 PM
  6. Replies: 4
    Last Post: 06-11-2010, 03:29 PM
  7. Deleting multiple similar words...?
    By silveraden in forum Excel General
    Replies: 3
    Last Post: 10-03-2007, 03:15 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