Thursday, February 25, 2016

Macro To Highlight Duplicate Records

             This Excel Vba Code is to find duplicate values in sheets of workbook. The duplicate records are searched in the used ranges of all sheets by macro :

For syf = 1 To Sheets.Count

Background of found records are painted and new borders are drew  :

For Each mycell In Selection
    If WorksheetFunction.CountIf(Selection, mycell.Value) > 1 Then
        mycell.Interior.ColorIndex = 8
        mycell.Borders.Weight = xlThin
        mycell.Borders.ColorIndex = 44
    End If

If desired  the processes can be recovered with "Undo Button".

No comments:

Post a Comment