I want to highlight all the duplicates of a concatenated string in column I and provide an error message if there are any duplicates highlighted. However, there are several blank cells in the column and I do not want these to show up as duplicates when I am running the macro.
I got this code from on here:
Sub HighlightDuplicateValues()
Dim myRange As Range
Range("I1", Range("I1").End(xlDown)).Select
Set myRange = Selection
For Each myCell In myRange
If Not IsEmpty(ActiveCell.Value) = True Then
If WorksheetFunction.CountIf(myRange, myCell.Value) > 1 Then
myCell.Interior.ColorIndex = 36
End If
End If
Next myCell
End Sub
I have absolutely no experience in VBA but from what little I understand it seems like it should work. However, what ends up happening is nearly all my data gets deleted. It's rather unfortunate.
Again, I want to highlight any duplicates in the concatenated column I, but I don't want these blank cells to count as duplicates. Having the code for an error message to pop up would be an excellent added bonus, but is not currently my main focus.
If you want to use VBA this should work for you.