I'm trying to find a way that when users enter a text that is already in a range, they get a msgbox telling them so.
I tried this method (data validation), but it doesn't work. Why?
It sounds simple, but I'm all out of ideas, please somebody help.
This is something I'm doing, but have no idea how to continue
The error here is that Samples is a Range in stead of a Double. I don't know how to get around it. Anybody have an idea??Private Sub Worksheet_Change(ByVal Target As Range)
Dim Samples As Range
Dim Totaal As Range
Set Samples = Range("a:a")
Set Totaal = Range("a:b")
j = WorksheetFunction.CountA(Samples)
Set Samples = Range("a2:a" & j)
If WorksheetFunction.CountIf(Totaal, Samples) >= 2 Then
MsgBox "duplicate detected"
End If
End Sub
Bookmarks