+ Reply to Thread
Results 1 to 7 of 7

Need macro for duplicates of specific cells in one column

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    Lehi, UT
    MS-Off Ver
    2007
    Posts
    8

    Need macro for duplicates of specific cells in one column

    I am looking for a macro that can find duplicates in the same column located between division markers and that have the same label in column A.

    In other words, I have a spreadsheet with labels in Column and values in Column B. I want to find duplicates of values in column A, but ONLY among items with the same label in column A.

    For the sake of example, suppose I have a list of countries, states, counties, and cities. Then I might only want to find duplicate city names, not duplicate county or state names.

    Additionally, column B has section divisions, and I only want to find duplicates within a section. For the sake of this example, let's say Column B has some cells with the value "Region". I would only want to find duplicate cities between "Region" cells.

    Attached is a spreadsheet showing the example. For the spreadsheet, the macro's result should write in Column C that "Phoenix" is a duplicate. However, it should ignore "Mesa" (because the two instances of "Mesa" are in different regions.
    Attached Files Attached Files

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

    Re: Need macro for duplicates of specific cells in one column

    Hi

    How about

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    08-06-2012
    Location
    Lehi, UT
    MS-Off Ver
    2007
    Posts
    8

    Re: Need macro for duplicates of specific cells in one column

    Wow! That was fast! When I try the macro in the sample spreadsheet I provided, it works. However, when I try it on a diffent workbook, I get the error message "Run-time error '1004': Appllication-defined or object-defined error'

    ---------- Post added at 05:00 PM ---------- Previous post was at 04:56 PM ----------

    I tried it again, and now the error is "Method 'Range' of object'_Global' failed.

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

    Re: Need macro for duplicates of specific cells in one column

    Hi

    Can you attach a copy of the workbook where it doesn't work?

    rylo

  5. #5
    Registered User
    Join Date
    08-06-2012
    Location
    Lehi, UT
    MS-Off Ver
    2007
    Posts
    8

    Re: Need macro for duplicates of specific cells in one column

    Sorry for the delay. I needed to change the spreadsheet to go with the example for security reasons.
    Attached Files Attached Files

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

    Re: Need macro for duplicates of specific cells in one column

    Hi

    OK, this has a slightly different structure, so try
    Please Login or Register  to view this content.
    rylo

  7. #7
    Registered User
    Join Date
    08-06-2012
    Location
    Lehi, UT
    MS-Off Ver
    2007
    Posts
    8

    Re: Need macro for duplicates of specific cells in one column

    Amazing. It seems to work like a charm! Thank you, thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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