+ Reply to Thread
Results 1 to 6 of 6

Find a specific condition and delete everything else

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    north carolina
    MS-Off Ver
    Excel 2010
    Posts
    3

    Find a specific condition and delete everything else

    Hello. This is my first time posting to a forum. My need is this...I have a large data set of individual products that fall into one of five segments. I want a macro to find all the items in one segment and do one of 2 things. Either 1) delete all the products that are not in the targeted segment or 2) copy/paste the targeted segment into a separate area.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Find a specific condition and delete everything else

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Find a specific condition and delete everything else

    redeyegravy,

    Welcome to the forum!
    Here's an alternate code that you can use for option 2, copy/paste the target segment into a separate area:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    03-06-2013
    Location
    north carolina
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Find a specific condition and delete everything else

    patel45...thank you for the reply. If I am understanding your code...

    the LR = Cells(Row.count)...basically names the column
    For j = LR...names the starting row of the data...basically these 2 lines identify the intersect.

    How can I modify your code to just delete the rows. I don't need it to to both.

    I tried to eliminate the "next" part of the macro...but the macor blew up because of the "For" naming part.

    I'm fairly new to macro functionality...your expertise is greatly appreciated!

    Please advise on my above question...

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Find a specific condition and delete everything else

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-06-2013
    Location
    north carolina
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Find a specific condition and delete everything else

    thank you patel45! I played around with your code and figured out how to manipulate it for my needs. Also...than you to tigeravatar for the other method for achieving my needs. I really appreciate all the expertise.

+ 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