• 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 duplication / repetition upon selection

Sarguroh

New Member
Hi All,

Is it possible through VBA to highlight duplication or repetition within a particular range when I select any cell in that range.

Say: John Doe is mentioned 5 times on the sheet, if I select any cell with "John Doe" in it, It shall also highlight all other cells which have "John Doe" in them.

Hope someone will definitely help me with it.

Thanks in advance.
 
Thanks Marc for your reply.

I have attached sample file for you.
 

Attachments

  • Highlight Repetitions.xlsx
    10.7 KB · Views: 6
consider entire sheet.
So as a beginner starter to paste to the worksheet module :​
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
               Dim Rg As Range, A$
    With Me.UsedRange
        If Not Intersect(.Cells, Target(1)) Is Nothing Then
              .Interior.ColorIndex = xlNone
               Set Rg = .Find(Target(1).Value, , xlValues, xlWhole)
            If Not Rg Is Nothing Then
                       A = Rg.Address
                Do
                           Rg.Interior.Color = vbGreen
                       Set Rg = .FindNext(Rg)
                Loop Until Rg.Address = A
                       Set Rg = Nothing
            End If
        End If
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Its not working. nothing is happening. do I need to edit in it something. I just copied and pasted it.
 
Last edited by a moderator:

As it works a treat on my end according to post #5 & your attachment,
you just need to well read the post #6 direction and apply …​
 
Back
Top