+ Reply to Thread
Results 1 to 5 of 5

Remove duplicates and change dates - VBA

  1. #1
    Registered User
    Join Date
    03-31-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    68

    Remove duplicates and change dates - VBA

    Hi all,

    I need to create a macro that will remove duplicates and leave everyone with one line. But dates will need to be amended before deletion of duplicates.

    The ONE remaining line will have:-

    1. The earliest Start date for each employee.

    2. The greatest end date for each employee UNLESS the line with the greatest start date, has an end date that is BLANK (This means the record is still ongoing, and should remain BLANK).

    Thanks in advance
    Please see image/data for example.

    Capture.JPG

    Example Data.xlsx

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Remove duplicates and change dates - VBA

    Try this:-
    Results start "E1"
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Remove duplicates and change dates - VBA

    wrightyrx7,

    With your raw data already sorted/grouped by column A, per your workbook.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the RemoveDuplicatesPlus macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Registered User
    Join Date
    03-31-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: Remove duplicates and change dates - VBA

    Hi Guys,

    Tested them both and both work perfectly!!!

    Thank you so so much this is a great help!

  5. #5
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Remove duplicates and change dates - VBA

    wrightyrx7,

    Thanks for the feedback.

    You are very welcome. Glad we could help.

    And, come back anytime.

+ 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. Replies: 14
    Last Post: 05-25-2021, 02:13 AM
  2. Replies: 1
    Last Post: 10-23-2012, 09:12 AM
  3. Replies: 5
    Last Post: 02-28-2012, 02:52 PM
  4. Need VBA code to remove entries if there are duplicates (remove them totally)
    By BrandonFromSingapore in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2012, 12:50 AM
  5. Replies: 2
    Last Post: 03-20-2011, 11:19 AM

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