+ Reply to Thread
Results 1 to 3 of 3

Message if duplicate found

Hybrid View

  1. #1
    Registered User
    Join Date
    11-14-2007
    Posts
    29

    Message if duplicate found

    Hello all,

    I'm requesting again for any help: This is what I'm currently working:

    My user is allowed to type certain numbers in Column A (range: A19 to 82). I need help for a macro that will alert the user that that value has been entered, then disallow entry of that duplicate value.

    Any help is much appreciated, as always.

    Thanks

    WK

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello WhiteKelso,

    Since you are allowing only certain numbers, why not use Data Validation on the cell range? This would be easier and faster than writing a macro.

    Sincerely,
    Leith Ross

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834
    to a sheet module
    Private Sub Worksheet_Change(ByVal Target As Range)
    With Target
        If (Not Intersect(.Cells, Range("A19:A82")) Is Nothing) * _
           (Not IsEmpty(.Value)) Then
           If WorksheetFunction.CountIf(Range("A19:A82"),.Value) > 1 Then
               MsgBox "Duplicate"
               Application.EnableEvents = False
               .ClearContents
               Application.EnableEvents = True
           End If
        End If
    End With
    End Sub

+ 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