PDA

View Full Version : Find Duplicates using VBA



smooshiz
11-14-2011, 12:05 PM
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!

smooshiz
11-14-2011, 12:19 PM
Never mind. I solved it myself x)

mdmackillop
11-14-2011, 12:20 PM
Providing homework solutions is against forum rules. If you post a proposed solution, we may hint as to the way forward.

mdmackillop
11-14-2011, 12:21 PM
Please post your solution for the benefit of others.