I'm finishing up a pedigree database of sorts that I've been working on as a personal project, and I need a way to highlight duplicate values. I know conditional formatting can be used to identify duplicates, but I need each duplicated value to be a different color. The goal:
I found a VBA code that properly colors duplicates, but I'm having issues translating it into my own workbook. Besides the issue with the VBA being written in Polish, it seems the author has created ranges I cannot find and/or have no access to (rngDoPokolorowania, Licznik, and others), and therefore cannot replicate.
How to find and color duplicate values with Excel and VBA » Marcin's Excel Tips
Would anyone be willing to help me figure out Marcin's VBA, or perhaps provide an alternative?

I found a VBA code that properly colors duplicates, but I'm having issues translating it into my own workbook. Besides the issue with the VBA being written in Polish, it seems the author has created ranges I cannot find and/or have no access to (rngDoPokolorowania, Licznik, and others), and therefore cannot replicate.
How to find and color duplicate values with Excel and VBA » Marcin's Excel Tips
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngKolory As Range
Dim rngDoPokolorowania As Range
Dim LicznikKolorow As Integer
Dim Licznik As Integer
Dim rngKolumna As Range
Dim rngDaneWypelnione As Range
' cells with colors to choose from
Set rngKolory = wksKolory.Range("rngKoloryStart").Resize(wksKolory.Range("settIleKolorow").Value, 1)
' cells with data to be "colored"
Set rngDoPokolorowania = wksDane.Range(Range("rngDaneStart"), Cells(65535, Range("rngDaneStart").Column).End(xlUp))
' column with data
Set rngKolumna = Columns("B")
With wksDane
Set rngDaneWypelnione = .Range(.Range("rngDaneStart"), .Range("rngDaneStart").Offset(10000).End(xlUp))
End With
If Not Intersect(Target, rngKolumna) Is Nothing Then
Application.ScreenUpdating = False '
' Let's clear the whole data area (set background color to default)
rngDaneWypelnione.Resize(rngDaneWypelnione.Count + 1).Interior.ColorIndex = _
wksKolory.Range("rngDomyslneTlo").Interior.ColorIndex
LicznikKolorow = 1 ' color counter reset
With rngDoPokolorowania
' first cell
If Application.WorksheetFunction.CountIf(rngDoPokolorowania, .Cells(1).Value) > 1 Then
.Cells(1).Interior.ColorIndex = rngKolory.Cells(LicznikKolorow).Interior.ColorIndex
LicznikKolorow = LicznikKolorow + 1
If LicznikKolorow > rngKolory.Count Then LicznikKolorow = 1
End If
'more than one cell
If rngDaneWypelnione.Count > 1 Then
' for following cells
For Licznik = 2 To .Count
If Application.WorksheetFunction.CountIf(rngDoPokolorowania, _
.Cells(Licznik).Value) > 1 Then
If Application.WorksheetFunction.CountIf(Range("rngDaneStart").Resize(Licznik - 1), .Cells(Licznik).Value) > 0 Then
.Cells(Licznik).Interior.ColorIndex = _
rngDaneWypelnione.Find(what:=.Cells(Licznik).Value, after:=.Cells(Licznik), SearchDirection:=xlPrevious, lookat:=xlWhole).Interior.ColorIndex
Else
.Cells(Licznik).Interior.ColorIndex = rngKolory.Cells(LicznikKolorow).Interior.ColorIndex
LicznikKolorow = LicznikKolorow + 1
If LicznikKolorow > rngKolory.Count Then LicznikKolorow = 1
End If
End If
Next Licznik
End If
End With
Application.ScreenUpdating = True
End If
End Sub
Would anyone be willing to help me figure out Marcin's VBA, or perhaps provide an alternative?