+ Reply to Thread
Results 1 to 9 of 9

Deleting All BUT Specific Rows

  1. #1
    Registered User
    Join Date
    07-08-2008
    Location
    New Jersey
    Posts
    52

    Deleting All BUT Specific Rows

    Hey guys,

    I searched through previous threads before writing to try and find a similar one to my situation, but couldn't edit any of the code in my favor. (still kind of new at this hehe)

    I have a list of peoples names with contact information like address, phone number etc. One of these columns designates the category the person is in. Is there a way I can delete all the people (rows) that aren't in a specific category?

    If it helps, the Category column is column W and the ones I'd like to keep are the people (rows) in the category of 'Logistics'.

    Any help would be greatly appreciated!

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    One way

    see link for other methods
    http://www.rondebruin.nl/delete.htm

    Please Login or Register  to view this content.
    VBA Noob
    Last edited by VBA Noob; 07-09-2008 at 05:12 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    07-08-2008
    Location
    New Jersey
    Posts
    52
    Thanks! It looks like that would work but when I try it, it says:
    "Compile Error: Invalid Outside Procedure" and its showing this:

    Please Login or Register  to view this content.
    Maybe its just because I'm still new at this, but do you have any suggestions on how to make it work?

    Thanks for your help!

    Pete
    Last edited by VBA Noob; 07-10-2008 at 02:19 PM.

  4. #4
    Registered User
    Join Date
    07-08-2008
    Location
    New Jersey
    Posts
    52
    I figured it out!

    Thanks again VBA Noob

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it helped.

    Please only use one set of code wraps next time thou. I've fixed it for you this time

    VBA Noob

  6. #6
    Registered User
    Join Date
    07-08-2008
    Location
    New Jersey
    Posts
    52
    Ah sorry, I wasn't sure which tags to use and must've double wrapped it.. heh

    Thanks again

  7. #7
    Registered User
    Join Date
    07-08-2008
    Location
    New Jersey
    Posts
    52

    Quick Edit

    Hey I was just wondering, what would I have to change in this code to make it start its search from the second row?

    Please Login or Register  to view this content.
    My first row labels each of the columns and everytime I run the macro, it deletes that row as well as the others..

    Thanks in advance,

    Pete

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    I would assume changing this line

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    VBA Noob

  9. #9
    Registered User
    Join Date
    07-08-2008
    Location
    New Jersey
    Posts
    52
    Thanks, that worked great! thought it had something to do with that line...

    One more quick thing in relation to this code:

    In regards to the line
    Please Login or Register  to view this content.
    I have a couple of different variations of 'Public relations' categories (Public relations;Attorney etc.) that get deleted when I run the macro.

    I tried putting all the different variations in that line but none of my attempts worked..

    Any ideas on how to add these variations into that line so they don't get deleted as well?

    Any help is greatly appreciated as always.

+ 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