Counts how many duplicates found in a range of Excel cells.
Basically how many cells that are duplicated in a range of cells in a certain range.
Needs MyRange as Range object to be passed
Helpful was part of some work needed last month
Might needs some work to make it better
Function CountDuplicates(MyRange As Range)
CountDuplicates = 0
For Each cel In MyRange
If cel.Row > MyRange.CurrentRegion.Rows.Count Then Exit For
If WorksheetFunction.CountIf(MyRange, cel.Value) > 1 Then CountDuplicates = CountDuplicates + 1
Next
End Function
CountDuplicates = 0
For Each cel In MyRange
If cel.Row > MyRange.CurrentRegion.Rows.Count Then Exit For
If WorksheetFunction.CountIf(MyRange, cel.Value) > 1 Then CountDuplicates = CountDuplicates + 1
Next
End Function
MyRange As Range
Views 942
Downloads 323
CodeID
DB ID