+ Reply to Thread
Results 1 to 10 of 10

Macro Deletes all rows except....

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    North East NJ
    MS-Off Ver
    Excel 2007
    Posts
    6

    Macro Deletes all rows except....

    Hello,

    How can I Delete all rows, except the rows that in Column "C" contain the word "DELV"


    Any help would be greatly appreciated, I've been "googling" this a couple days, trying multiple different things, and nothing has worked just yet.

    Thanks,

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

    Re: Macro Deletes all rows except....

    Try

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 10-25-2012 at 12:53 PM. Reason: Updated the text to keep to a wildcard after
    HTH
    Regards, Jeff

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

    Re: Macro Deletes all rows except....

    Please Login or Register  to view this content.

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

    Re: Macro Deletes all rows except....

    Quote Originally Posted by TheDriver85 View Post
    How can I Delete all rows, except the rows that in Column "C" contain the word "DELV"
    @AB33,

    Did you test your solution before posting? The reason I ask, when deleting rows you should always step backwards and the OP wanted to keep the rows with "DELV".

  5. #5
    Registered User
    Join Date
    10-25-2012
    Location
    North East NJ
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Macro Deletes all rows except....

    Cool, it worked.

    Thanks guys.

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

    Re: Macro Deletes all rows except....

    Quote Originally Posted by TheDriver85 View Post
    Cool, it worked.
    Can I ask what worked, which solution? Somebody following this thread may find it useful.

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

    Re: Macro Deletes all rows except....

    Jeffrey!
    Thanks!
    You are right! I did not test it. It was a wrong code any way.

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

    Re: Macro Deletes all rows except....

    Quote Originally Posted by AB33 View Post
    Jeffrey!
    Thanks!
    You are right! I did not test it. It was a wrong code any way.
    It just needed a few tweaks but it worked; however, I would opt for the filter method as it is a little more efficient than looping.

  9. #9
    Registered User
    Join Date
    10-25-2012
    Location
    North East NJ
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Macro Deletes all rows except....

    I used yours Jeffrey.

    Thanks,

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

    Re: Macro Deletes all rows except....

    Glad you got what you needed and thanks for the feedback

    -----------------------------------------------------------------------

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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