satish gubbi
02-08-2012, 07:29 AM
Hi
I found the below code which will color the duplicates, kindly help me to add below condition
After:=ActiveCell _
, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False
into the code, so that each cell in column C will be considered for finding duplicates from the begining to end of the column and highlight the Cell even value found with or without suffix or prefix's
Sub Highlight_Duplicates()
Dim Rng As Range, MyCell As Range
Set Rng = Range("C1:C" & Range("C" & Rows.Count).End(xlUp).Row)
For Each MyCell In Rng
If Application.WorksheetFunction.CountIf(Rng, MyCell) > 1 Then
Range(MyCell.Address & ":" & "C" & MyCell.Row).Interior.ColorIndex = 6
Else
MyCell.EntireRow.Interior.ColorIndex = xlNone
End If
Next MyCell
End Sub
Kindly help
I found the below code which will color the duplicates, kindly help me to add below condition
After:=ActiveCell _
, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False
into the code, so that each cell in column C will be considered for finding duplicates from the begining to end of the column and highlight the Cell even value found with or without suffix or prefix's
Sub Highlight_Duplicates()
Dim Rng As Range, MyCell As Range
Set Rng = Range("C1:C" & Range("C" & Rows.Count).End(xlUp).Row)
For Each MyCell In Rng
If Application.WorksheetFunction.CountIf(Rng, MyCell) > 1 Then
Range(MyCell.Address & ":" & "C" & MyCell.Row).Interior.ColorIndex = 6
Else
MyCell.EntireRow.Interior.ColorIndex = xlNone
End If
Next MyCell
End Sub
Kindly help