+ Reply to Thread
Results 1 to 6 of 6

Finding/moving duplicate entries across multiple sheets

  1. #1
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100

    Finding/moving duplicate entries across multiple sheets

    Hopefully someone here can help, or at least give me a starting point, as I'm a bit lost as to how to do this.

    I have 2 workbooks, each with 9 sheets. I need to merge the 2 workbooks (I can figure that bit out myself - I'll do it manually if need be).

    The problem is then that there are likely to be duplicate entries across all 9 sheets (i.e. an entry on sheet 1 could have duplicates on sheets 3 and 5).

    What I need to do is find these duplicates, and then move them so that they are under the original entry (and also delete them from where they originally sit)

    Hope this makes sense, and that someone can help.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Have a look at the attached.

    I've assumed that column A is the lookup reference. The macro is called aaa. See if this gets you going.

    rylo
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100
    Quote Originally Posted by rylo
    Hi

    Have a look at the attached.

    I've assumed that column A is the lookup reference. The macro is called aaa. See if this gets you going.

    rylo
    That is exactly it! You are a star!

    Can I be a tad cheeky and ask for a bit of an explanation of what's going on with this one? I can follow it to a point, but I'd like to fully understand this one, to increase my (limited) knowledge a bit.

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    What it is doing is taking each sheet's data, and comparing it to the data on all the following sheets. So the outer loop is starting at sheet1, and cycling through all the sheets except for the last one, as the last one won't have any further sheets to cover
    Please Login or Register  to view this content.
    It then selects the first sheet.

    Now it has to look at all the entries in column A
    Please Login or Register  to view this content.
    This has to be compared to all the following sheets, so the second loop covers the sheet selection aspect.
    Please Login or Register  to view this content.
    It then tries to find the value from the first sheet in the comparison sheet. I've used the find function for this.
    Please Login or Register  to view this content.
    It then tests the result of the find. If it finds a match, it copies the entire row, insert pastes the row after the existing entry, then deletes it from the check sheet.
    Please Login or Register  to view this content.
    One thing is that as it puts the subsequent item under the item being tested, the subsequent items will not be in the same order as they were originally found. So in the example file, a is found on all 3 sheets. At the end, the sheet order of the a items will be 1,3,2. To see what I mean, put a 1 in column B against all the items on sheet1, 2 for sheet2 and 3 for sheet3. Check the order of the output.


    Hope that makes sense.

    rylo
    Last edited by Paul; 12-18-2007 at 06:55 PM.

  5. #5
    Registered User
    Join Date
    01-22-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Finding/moving duplicate entries across multiple sheets

    Hi, I'm having the same issue except I just want the duplicates to be highlited. What needs to be changed in the sample macro. I'm afraid I have never used macros before so simplicity is needed.

    Thank You

    Glenn

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Finding/moving duplicate entries across multiple sheets

    Hi Glenn & Welcome to the Forum,

    Seeing this thread is over 5 years old, your chances of getting more exposure into your query will significantly increase if you create your own thread.

    Also, please take a few minutes to look over the Forum Rules as this is one of our rules.
    HTH
    Regards, Jeff

+ 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