VBA Macro code for highlighting duplicate records in a spreadsheet
Sub showduplicate()
Dim rng As Range
Dim cell As Variant
Set rng = Application.InputBox("Select your Range", "My range", Type:=8)
For Each cell In rng
If WorksheetFunction.CountIf(rng, cell.Value) > 1 Then
cell.Interior.ColorIndex = 16
End If
Next cell
End Sub
Sub showduplicate()
Dim rng As Range
Dim cell As Variant
Set rng = Application.InputBox("Select your Range", "My range", Type:=8)
For Each cell In rng
If WorksheetFunction.CountIf(rng, cell.Value) > 1 Then
cell.Interior.ColorIndex = 16
End If
Next cell
End Sub
No comments:
Post a Comment