View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default VBA Code macro for duplicate entries

Select your range and run:

Sub DupFinder()
Dim r As Range, t As Range
Set t = Selection
For Each r In t
v = r.Value
If Application.WorksheetFunction.CountIf(t, v) 1 Then
r.Interior.ColorIndex = 3
End If
Next
End Sub

This is a general routine based on Selection. If you don't want to have to
Select then replace:

Set t = Selection
with:
Set t = Range("J14:AA14")
--
Gary''s Student - gsnu200781


"KCG" wrote:

Hello friends,

I have my data in the range J14:AA14.

Please help me to create a VBA macro which will find duplicate entries in
this range and colour both cells red.

Thanx

--
KCG