I am trying to write a macro that examines if the cells of one column have unique values as compared to the cells of another column. So basically I want to look at cell F1, then compare it to every cell in Column G. If it finds a duplicate value anywhere in Column G it will put "duplicate" in Cell M1, if not it will put "unique". I have started the macro and have the following:
Sub Macro1()
Dim i As Integer, Finder As Variant, SearchRange As Range, c As Variant
i = 1
Cells(i, 5).Select
Do Until Selection.Value = ""
Finder = Right((Selection.Value), (Len(Selection.Value) - 7))
Set SearchRange = ActiveSheet.Columns(7)
For Each c In SearchRange
If c.Value = Finder Then
Selection.Offset(0, 7).Value = "duplicate"
Else: selections.Offset(0, 7).Value = "unique"
End If
Next
i = i + 1
Loop
End Sub
However I keep getting a runtime error 13 - type mismatch at 'If c.Value = Finder Then'
any help sorting me out would be much appreciated. thanks.
I assume that one of these (either side of the = ) is null perhaps - isn't there an IsNull() to test for that - if indeed it is the case?