• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Highlight Duplicate Values

jskushawah

New Member
I have some values in range A1:A34 between 1,25.

I need a formula which highlights the duplicate values.


Any help will appreciate.
 
Hi ,


This is not related to the original poster's question , but just in case anyone finds it useful.

[pre]
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.Intersect(Target, Range("Data_Range")) Is Nothing Then
Range("Data_Range").Interior.Color = xlNone
Exit Sub
End If

Dim duplicates As Boolean

Dim dr As Range
Set dr = Range("Data_Range")

Dim min_row As Long
min_row = dr.Row

Dim data_array As Variant
data_array = dr.Value
dr.Interior.Color = xlNone
row_num = Target.Row - min_row + 1
For i = LBound(data_array, 1) To UBound(data_array, 1)
If data_array(i, 1) = Target And row_num <> i Then
duplicates = True
dr.Cells(1, 1).Offset(i - 1).Interior.Color = vbYellow
End If
Next

If duplicates Then
Target.Interior.Color = vbYellow
Else
MsgBox "No duplicates for this data ..."
End If
End Sub
[/pre]
Narayan
 
Back
Top