Consulting

Results 1 to 4 of 4

Thread: Find Duplicates using VBA

  1. #1
    VBAX Newbie
    Joined
    Nov 2011
    Posts
    2
    Location

    Find Duplicates using VBA

    Hi everyone,

    I'm in IT class and my task is to find duplicates in a set of data using VBA in Excel. For simplicity's sake, I have five entries in column A, like so:

    A
    B
    C
    A
    D

    I would like to loop through this set of data to locate the duplicates. My teacher has hinted that I should compare the process in real life, where if we were to find duplicates in this set of data, for example, I would first look at A, and look through the rest of the data in the column to see if there are any duplicates. Then I would move on to B, and go through the column again to see if there are duplicates, and so on. Everytime I move onto a new letter though, I technically only need to look at the letters that follow it to check for duplicates (because I've already checked the ones before it previously).

    I would like to have the text "SAME" show up in the cell next to the duplicates (in the next column).

    Following this logic, how do I set my variables and come up with a VBA code to complete this task?

    Many thanks!

  2. #2
    VBAX Newbie
    Joined
    Nov 2011
    Posts
    2
    Location
    Never mind. I solved it myself x)

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Providing homework solutions is against forum rules. If you post a proposed solution, we may hint as to the way forward.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Please post your solution for the benefit of others.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •