+ Reply to Thread
Results 1 to 4 of 4

Find and Delete rows based on criteria in multiple columns

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    ATL
    MS-Off Ver
    2007
    Posts
    18

    Question Find and Delete rows based on criteria in multiple columns

    All, I need help writing a macro that will find and delete rows within a table with specified critetia located in multiple columns.

    Here are the report details.

    Workbook is titled "Red", WS is titled "Blue".

    The criteria is located in multiple columns and Column K is the only column with multiple criteria within that column.
    Criteria1 - Col "L" - "K"
    Criteria2 - Col "K"- <> "01", "02", "03"
    Criteria3 - Col "AG" - "LIGHT"

    As a side note, this report is dynamic in rows but never columns. the column range is "A:AH"

    Any help is greatly appreciated. TIA.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Find and Delete rows based on criteria in multiple columns

    Hello Doctor_H,

    This macro will delete the rows based on the criteria you gave. This is done by creating an array of the range data that is not to be deleted. The original is then deleted and the array is copied into the range.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-22-2013
    Location
    ATL
    MS-Off Ver
    2007
    Posts
    18

    Re: Find and Delete rows based on criteria in multiple columns

    Hi Leith, thank you for your response. I tried the code but got a runtime error 9. Here's the conflicting line of code.
    Please Login or Register  to view this content.
    Any idea of what the cause might be?
    Thanks again!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Find and Delete rows based on criteria in multiple columns

    Hello Doctor_H,

    One the name arguments is misspelled. clWhole should be xlWhole

+ 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. Delete Multiple Rows based on Criteria
    By athyeh in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-20-2013, 03:13 PM
  2. [SOLVED] Delete Rows based on criteria in two columns
    By KSSLR in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-30-2013, 04:39 PM
  3. Find rows and delete them based on multiple criteria
    By kostas in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-31-2012, 11:59 AM
  4. Delete rows based on multiple criteria
    By ohkking in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-18-2011, 11:30 AM
  5. Delete rows based on multiple criteria
    By couger77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2007, 03:29 PM

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