+ Reply to Thread
Results 1 to 6 of 6

Delete duplicate older sheet

  1. #1
    Registered User
    Join Date
    02-12-2018
    Location
    Nuernberg
    MS-Off Ver
    2013
    Posts
    20

    Delete duplicate older sheet

    Hello everyone

    I have a macro which combines different projects into 1 workbook with each sheet representing a different project. The project name is in cell A1 , the project total expenses is in cell V19. Sometimes it happens that I download the same project twice at two different dates but I want to keep only the most recent update, hence the one with the most expenses.

    I need a macro which goes through all the sheets in the workbook and when it finds 2 or more sheets with the same project name in cell A1, it compares the values in cell V19 and keeps the sheet with the highest value. Is it even possible to have a Macro which does this, I don't know where to start.

    Thank you in advance

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Delete duplicate older sheet

    Try this and see if it works for you. Please take a copy of your workbook first because it deletes sheets!

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    02-12-2018
    Location
    Nuernberg
    MS-Off Ver
    2013
    Posts
    20

    Re: Delete duplicate older sheet

    It works perfectly. I'm amazed, thanks a lot man! I apologize for replying a bit late but I had problems with my laptop since I posted here.

    I'm trying to understand your code and I'm still relatively new to VBA, would it be too much to ask if you could add some explanation to the lines to understand it better? Like for example the line "Set Dict = CreateObject("Scripting.Dictionary")" --> what does this do/mean?

    Again, this is just if you have the time and feel like it, but the code works and thank you once more

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Delete duplicate older sheet

    Commented code:

    Please Login or Register  to view this content.
    You can find more information on the dictionary object here: https://docs.microsoft.com/en-us/off...tionary-object

    WBD

  5. #5
    Registered User
    Join Date
    02-12-2018
    Location
    Nuernberg
    MS-Off Ver
    2013
    Posts
    20

    Re: Delete duplicate older sheet

    Amazing, understand it much better now.

    Thanks alot ^^

  6. #6
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Delete duplicate older sheet

    No problem. Please mark the thread as SOLVED using the thread tools.

    WBD

+ 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: 1
    Last Post: 05-10-2019, 05:05 AM
  2. [SOLVED] Need to Delete Duplicate with Older Date
    By mantis1117 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-07-2018, 10:45 PM
  3. Remove Duplicate Row IF Older
    By BrutalDawg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2017, 08:47 PM
  4. Remove duplicate records with older date and time
    By bongielondy in forum Excel General
    Replies: 3
    Last Post: 02-17-2014, 10:22 AM
  5. I need to delete duplicates with older information in
    By jessicaoshea in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-22-2013, 05:46 AM
  6. Replies: 4
    Last Post: 05-14-2013, 11:14 PM
  7. Delete lines with older date
    By VDREECK in forum Excel General
    Replies: 2
    Last Post: 01-14-2011, 03:51 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