Macro help


Posted by Steve on August 24, 2001 1:18 PM

I have a spreadsheet with 10,000 rows in it and I need to analyze a column for duplicate entries. Upon finding a duplicate I need to stop and see the duplicates and then carry on with the macro picking out the duplicates as I go along. First of all, is this even possible and if it is how much VB Code is involved and would anyone have any ideas on how to get this done. Thanks for your help!



Posted by sean tobin on August 24, 2001 4:52 PM

This will only help if you can sort the sheet by the column that contains the data to be checked for duplicates. I mean, the way i have done it will only work if you can sort the data, I'm sure there's another way but this works.

Assuming that Col A contains the data that needs to be checked:

Sub Macro1()
Range("A2").Select

Do Until ActiveCell = ""
compare = ActiveCell.Offset(-1, 0).Value
If ActiveCell = compare Then
MsgBox "Found duplicate"
Selection.Offset(1, 0).Select
Else
Selection.Offset(1, 0).Select
End If
Loop
End Sub