Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for duplicate numbers 1

Status
Not open for further replies.

stussy

MIS
May 22, 2003
269
GB
Hi

Wondered if anyone had any ideas that would help here. We import items into our epos application from excel sheets. Every week we find that one supplier or another has included the same barcode on multiple products, which crashes out the import routine, and we then have to sort the sheet by barcode, and look for the duplicates.

Any good ideas for automating this task? Something that just searches one column for duplicate values?

Cheers

Mike
 
Here’s a quick little macro that will highlight any duplicates (including the first occurrence):

Code:
Sub FindDupes()
ActiveCell.EntireColumn.Select
myColumn = Mid(ActiveCell.Address, 2, (InStr(2, ActiveCell.Address, "$")) - 2)
myCell = Replace(ActiveCell.Address, "$", "")
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
    "=COUNTIF(" & myColumn & ":" & myColumn & "," & myCell & ")>1"
Selection.FormatConditions(1).Interior.ColorIndex = 6
End Sub

[tt]_____
[blue]-John[/blue]
[/tt][red]Quidquid latine dictum sit, altum viditur[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Fastest useful reply I have ever seen on TT! You have just made our epos admin's life 50 times easier! Cheers, have a beer on me later...well failing that have a star...
 
Dang, I'd really like that beer.

Oh well, glad I could help.
[cheers]

[tt]_____
[blue]-John[/blue]
[/tt][red]Quidquid latine dictum sit, altum viditur[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top