Idenfity duplicate records in a range

keith05281967

Board Regular
Joined
May 6, 2011
Messages
68
Greetings VBA wizards,

I'm trying to have my code look thru a specific column of data, in this case ID numbers and hi-lite any duplicates found. This seems simple enough but i'm not having much success.

I recorded a macro and have been using that but it's so complicated I don't know how to manipulate it. I want something simple. Something like the below. The below doesn't work because i'm mis-using a method. Can someone show me the light?


'check for duplicate loans
If Cells(i, ColumnNumber).AddUniqueValues = False Then
Cells(i, ColumnNumber).Interior.ColorIndex = 3
End If


the result i'm looking for would be as follows:

ID column
123456
456789
789123
123456 <-- hi lited because it's a dup.


using Excel 07
thanks,
Keith
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Select range A2:A5
Choose Format|Conditional Formatting
From the first dropdown, choose Formula Is
For the formula, enter
=COUNTIF($A$2:$A$5,A2)>1
Click the Format button.
Select a font colour for highlighting.
Click OK, click OK
 
Upvote 0
thank you for the reply Phil - i'm looking for a vba code solution so that i don't have to be "hands on" in the worksheet.
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,522
Members
452,923
Latest member
JackiG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top