+ Reply to Thread
Results 1 to 5 of 5

macro - delete rows based on multiple criteria.

  1. #1
    Registered User
    Join Date
    04-26-2011
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    22

    macro - delete rows based on multiple criteria.

    Hi

    I have a large spreadsheet with many rows (around 4-10000). There are some rows which I need to delete based on specific criteria.

    Rows that have a value in Column B of "P16252,P16253,P16254,P16255,P16256,P16257,P16258,P16259)

    Rows that either have values in Column J of:

    Receiving

    I also want to delete any rows that contain the following words in Column J.

    Accrual
    Prepayment
    Dynamic

    I thought about using the autofilter, but started getting complicated when some of the cells didn't have specific values but contained text that identified they shoudl be deleted.

    Any help would be greatly appreciated.

    Thanks

    Chock

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: macro - delete rows based on multiple criteria.

    So either column B should have the numbers listed OR column J should have those words to make it eligible for deletion?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    04-26-2011
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: macro - delete rows based on multiple criteria.

    thanks, yes. Any row that has the entries of P16252 to P16259 in column B should be deleted and if there are any values matching Receiving or have certain words contained in the cell value should also be deleted, these values would be found in Column J.

    Hope that makes sense.

    Thanks

    Chock

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: macro - delete rows based on multiple criteria.

    I think this will do what you want. If not, you might have to adjust the function IsBadRow.


    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: macro - delete rows based on multiple criteria.

    FWIW:

    Please Login or Register  to view this content.

+ 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