+ Reply to Thread
Results 1 to 3 of 3

VBA to delete rows based on multiple criteria

  1. #1
    Registered User
    Join Date
    09-05-2017
    Location
    Hong Kong
    MS-Off Ver
    2013
    Posts
    14

    VBA to delete rows based on multiple criteria

    Hello all,

    I have recently started teaching myself VBA and thus far have been somewhat successful, with a fair amount of trial and error. However, I have come to stumbling block and looking for some assistance.

    The problem:
    I have a set of data, columns A - L.

    A B C D E F G H I J K L
    NAME ID EVENT ID TASK TYPE CLASS DATE 1 DATE 2 DATE 3 DATE 4 DATE 5 DATE 6
    ABC 123000 QAZ EX QWER A 01/01/2017 null null 03/01/2017 null null
    DEF 456000 WSX EX ASDF A null 02/01/2017 01/01/2017 03/01/2017 null null
    DEF 456000 WSX EX ASDF A null 02/01/2017 01/01/2017 09/01/2017 null null
    GHI 789000 EDC EX QWER B null 02/01/2017 01/01/2017 03/01/2017 null null
    JKL 321000 RFV EX QWER B null 02/01/2017 01/01/2017 03/01/2017 null null
    MNO 654000 TGB EX QWER C null 02/01/2017 01/01/2017 03/01/2017 null null
    MNO 654000 TGB EX QWER C null 02/01/2017 01/01/2017 03/01/2017 null null
    PQR 987000 YHN EX ASDF C null 02/01/2017 01/01/2017 03/01/2017 null null
    STU 321111 UJM EX ASDF C null 02/01/2017 01/01/2017 03/01/2017 null null
    STU 321111 UJM EX ASDF C null 02/01/2017 01/01/2017 04/01/217 null null
    VWX 654111 IKL EX ASDF A null 02/01/2017 01/01/2017 03/01/2017 null null
    YZ 987111 IOP EX QWER A 01/01/2017 null null 03/01/2017 null null
    YZ 987111 IOP EX QWER A 01/01/2017 null null 04/01/2017 null null
    YZ 987111 IOP EX QWER A 01/01/2017 null null 03/01/2017 null null



    (Apologies for the format, currently unable to upload anything - it looks fine before I post the thread, then loses all formatting!?)

    I have rows that will have matching information in columns A - F, but a differing date in column J. I need code to find the rows that are matching columns A-F, but only keep the
    one with the earliest date in column J, if column D contains 'EX' in it (may have other info as well, so I guess the use of a wild card here would be needed).
    It may also be possible that there will be rows with exactly the same information in every column, for these only one record should be kept.

    The data set is usually fairly extensive, so would need the code to continue until column A no longer has any value.

    hopefully that makes sense, as always hugely appreciate any assiustance from this wonderful resource. Let me know if any clarifications are needed.
    Last edited by jamesmullens; 11-27-2017 at 11:39 PM.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA to delete rows based on multiple criteria

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    09-05-2017
    Location
    Hong Kong
    MS-Off Ver
    2013
    Posts
    14

    Re: VBA to delete rows based on multiple criteria

    Hi,

    Yes, I meant I couldn't upload from the PC I am using as it is not permitted. I will add the attachment when I get home.

+ 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. macro - delete rows based on multiple criteria.
    By ChocksterNo1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-05-2013, 10:22 AM
  3. [SOLVED] Delete multiple rows based on sigle criteria
    By fiesty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2013, 09:58 AM
  4. Delete Multiple Rows Based on Criteria in 1 Column
    By Farmer12345 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-20-2013, 04:41 PM
  5. [SOLVED] Delete Rows based on Multiple Name Criteria
    By Graham Taylor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-14-2012, 09:11 AM
  6. 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
  7. Delete rows based on multiple criteria
    By ohkking in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-18-2011, 11:30 AM
  8. Delete rows based on multiple criteria
    By couger77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2007, 03:29 PM

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