+ Reply to Thread
Results 1 to 1 of 1

How to eliminate duplicate entries

  1. #1
    Registered User
    Join Date
    05-06-2005
    Posts
    1

    How to eliminate duplicate entries

    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

    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
    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??
    Last edited by fnx; 05-06-2005 at 08:21 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1