Hello to all,
I found online this macro highlighting duplicate values:
Sub colora_duplicate()
Dim t As Single
t = Timer
Dim q&, X&, i&, a
Dim ash As Worksheet
Set ash = ActiveSheet
q = Range("A" & Rows.Count).End(3).row - 3
a = Range("A2").Resize(q)
Application.ScreenUpdating = False
ActiveSheet.Unprotect "123456"
With Sheets.Add
.Cells(1).Resize(q) = a
.Cells(2) = 1: .Cells(2).Resize(q).DataSeries
.Cells(1).Resize(q, 2).Sort .Cells(1), 1, Header:=xlNo
a = .Cells(1).Resize(q + 1)
For i = 1 To q
If a(i, 1) <> a(i + 1, 1) Then
If i > X + 1 Then _
.Cells(X + 2, 1).Resize(i - X - 1).Font.ColorIndex = 3
X = i
End If
Next i
.Cells(1).Resize(q, 2).Sort .Cells(2), 1, Header:=xlNo
.Cells(1).Resize(q).Copy ash.Range("A2")
Application.DisplayAlerts = False
.Delete
Application.DisplayAlerts = True
End With
ActiveSheet.Unprotect "123456"
Call centra_colonna
Call rimetti_formula
Application.ScreenUpdating = True
'MsgBox "Code took " & Format(Timer - t, "0.00 secs")
MsgBox "controllato in " & Format(Timer - t, "0.00 secs"), 0, "Avviso"
End Sub
you can a change?
Now if this is a duplicate value is highlighted.
The change is to add the word "duplicate" in cell C
If not duplicate add the word "not duplicate."
I hope I was cpmprensibile.
A greeting,
max_max
Bookmarks