View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Aaron Aaron is offline
external usenet poster
 
Posts: 287
Default Duplicate Msgbox

I foud the following code but would like to add a msgbox that if Duplicates
found
A msgbox is tiggered and shows the count of the 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, "B").End(xlUp).Address
'Define the range to examine
Set Cell_Range = ActiveSheet.Range("B1", 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



Thanks,
Aaron