View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_2_] Nigel[_2_] is offline
external usenet poster
 
Posts: 735
Default Cecking for duplicates

This code sets up a conditional format for column A (names in A2 onwards), I
set limit to row 500, change as required. Note: xl2007 version used.

Sub DuplicateConditional()
With Range("A2:A500") ' < set limit of your range here
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(A:A,A2)1"
.FormatConditions(.FormatConditions.Count).SetFirs tPriority
With .FormatConditions(1).Font
.Bold = True
.Color = -16776961
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
End With
End Sub

--

Regards,
Nigel




"MJKelly" wrote in message
...
Hi,

I have a column of data which needs to be checked for duplicates, how
would I do this with a macro? The data is a list of names which have
been assigned to tasks. I can't have the same person assigned to two
tasks/jobs. Would be great if the duplicates are shown in a different
colour once the macro is finished so I can make the necessary changes.

hope you can help.
Matt