+ Reply to Thread
Results 1 to 9 of 9

Search for every value in a certain range and delete any row that contains any

  1. #1
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Search for every value in a certain range and delete any row that contains any

    Hello! I have a macro that searches a worksheet for a word, and deletes any row that contains that word. I would like to, instead, use a range of words, and delete any row that contains any word in the range! Here is what I have so far.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The Range I wish to use is D2:D20 on the worksheet "Config". This macro is going to be used on multiple different worksheets, but the range of words I'm going to use will always be Config!D2:D20.

    Thank you for your time!

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Re: Search for every value in a certain range and delete any row that contains any

    You could loop through D2:D20, something like:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Search for every value in a certain range and delete any row that contains any

    Maybe I should be more clear. What I am looking for instead of

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Or the equivalent of that. I'm not trying to remove rows from Range D2:D20, I'm USING that range to remove rows from a whole other Worksheet ("Config")

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for every value in a certain range and delete any row that contains any

    Tim,
    It can be done with find function, but will do it slightly different to wend loop, but I would like to see a sample for testing.

  5. #5
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Search for every value in a certain range and delete any row that contains any

    I'll post one tomorrow morning. The sheet itself is on my office computer.

  6. #6
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Search for every value in a certain range and delete any row that contains any

    Here we go, this should do.

    SampleBook2.xlsm

  7. #7
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Search for every value in a certain range and delete any row that contains any

    I've solved it! I changed to an If Then, and used an array for the Remove List.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for every value in a certain range and delete any row that contains any

    Tim,
    Sorry!
    I did not get back to you on time, but you have resolved it yourself.
    Well done!
    I was about to post very similar code, but you have got it.

  9. #9
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Search for every value in a certain range and delete any row that contains any

    Thanks for your time anyways. You've been very helpful to me!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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