شنبه یازدهم مرداد ۱۳۹۹ - 14:16 - حسين حسين پور -
If you have a large data-set, you can use this macro code to check the entire data and highlight duplicate values.
This code loops through each cell one by one and applies red color all those cells which are the duplicate.
Sub DuplicateValuesFromTable()
Dim myRange As Range
Dim i As Integer
Dim j As Integer
Dim myCell As Range
Set myRange = Range("Table1")
For Each myCell In myRange
If WorksheetFunction.CountIf(myRange, myCell.Value) > 1 Then
myCell.Interior.ColorIndex = 3
End If
Next
End SubImportant Note: In the above code, we have used the table name "Table1", you can change this name from the code. Or, if you have a range then you can simply use range name.
با نام و یاد خدا