highlighting the repeated data

  • Thread starter Thread starter Anil showreddy
  • Start date Start date
A

Anil showreddy

Hi,

i have data like this

codeno name B1 B2 B3 etc...
001 xyz 5 2 3 etc...
003 iju 1 5 9 etc..
..
..
..

this codeno is a unic number unfortunatly if two or more guys having same
code those has to higlighted with BOLD.

Thanks in advance..
 
I'm not really sure what you're talking about here, but the code below will
allow you to highlight duplicates:
Sub HighlightDuplicates()

'Highlight duplicates in Yellow
Dim cell As Range
Dim Cell_Range As Range
Dim MyCollection As New Collection

'Find last cell entry in the row
LastEntry = ActiveSheet.Cells(Rows.count, "A").End(xlUp).Address
'Define the range to examine
Set Cell_Range = ActiveSheet.Range("A1", LastEntry)

For Each cell In Cell_Range
On Error Resume Next
MyCollection.Add Item:="1", Key:=cell.Text
If Err.Number = 457 Then
cell.Interior.ColorIndex = 6
Err.Clear
End If
Next cell

End Sub

Regards,
Ryan---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top