+ Reply to Thread
Results 1 to 12 of 12

Delete Entire rows without loop with multiple partial strings criteria

  1. #1
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Delete Entire rows without loop with multiple partial strings criteria

    I have a selection of cells

    From this selection I want to delete all rows that DO NOT [edited] have "String1" or "String2" as part of that cell.

    I have done it with loop but that takes much time. Is it possible to do this without loop?

    Note: Selection is from a single column.
    Last edited by caabdul; 03-04-2018 at 08:51 AM.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Delete Entire rows without loop with multiple partial strings criteria

    You can use reverse loop from the last row in the selection and then to store the cells that match the criteria in a range variable and at the end to delete the whole stored range ..
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Delete Entire rows without loop with multiple partial strings criteria

    I would filter for "Contains" String 1, clear those rows, filter for "Contains" String 2, clear those rows, and then sort on an appropriate columns to close up blanks.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Delete Entire rows without loop with multiple partial strings criteria

    Sorry, I misstated. I wanted to remove rows that DID NOT meet the criteria.

  5. #5
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,342

    Re: Delete Entire rows without loop with multiple partial strings criteria

    or you can do using replace ,manipule data example in columns(1) you have formula than you can replace string1 become error
    Please Login or Register  to view this content.
    "Presh StarFor Attention * For Add Reputation!!"

  6. #6
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Delete Entire rows without loop with multiple partial strings criteria

    Hi daboho

    Thanks but I want to keep the rows that contain any of these two strings and remove the other rows.

  7. #7
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,342

    Re: Delete Entire rows without loop with multiple partial strings criteria

    Please Login or Register  to view this content.
    or not 2 string
    Please Login or Register  to view this content.
    Last edited by daboho; 03-03-2018 at 04:31 PM.

  8. #8
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Delete Entire rows without loop with multiple partial strings criteria

    Hi daboho

    I tried but it deletes all the rows

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Delete Entire rows without loop with multiple partial strings criteria

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    HTH
    Regards, Jeff

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Delete Entire rows without loop with multiple partial strings criteria

    This should do it.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 03-03-2018 at 08:37 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  11. #11
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,342

    Re: Delete Entire rows without loop with multiple partial strings criteria

    if you want delete all rows except "string1" and "string2"
    Please Login or Register  to view this content.
    Last edited by daboho; 03-04-2018 at 01:56 AM.

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Delete Entire rows without loop with multiple partial strings criteria

    Suddenly marked as solved ?

+ 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. [SOLVED] loop multiple criteria & delete matching rows?
    By Quint6778 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-09-2017, 09:58 AM
  2. Using loop(s) to delete rows based on criteria
    By Fish_Bio in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-09-2015, 03:02 PM
  3. [SOLVED] delete entire row if multiple criteria are satisfied
    By 4evra in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-20-2013, 08:06 AM
  4. Loop through rows and delete based on criteria
    By yolandaro30 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-27-2012, 12:23 PM
  5. Delete rows NOT containing 1 of multiple strings in a column
    By jarochnrol in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2011, 05:13 PM
  6. Loop to delete rows meeting criteria
    By narrowgate88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2009, 04:54 PM
  7. delete entire rows based on a criteria
    By acekargo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2008, 11:15 PM

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