+ Reply to Thread
Results 1 to 5 of 5

Prevent duplicates Excel user form

  1. #1
    Registered User
    Join Date
    02-11-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    27

    Prevent duplicates Excel user form

    Hi

    I need to check whether a value in one text box ("txtRCAname") OR a value in a second text box ("txtRCAname") in a userform already appear in my data.

    The value in "txtRCAname" needs to be checked against a column of data in a worksheet called "RCA_Data", column A2:A1000.

    The value in "txtRCAcode" needs to be checked against a column of data in the same worksheet called "RCA_Data", column B2:B1000.

    If a duplicate is found, I would like a message box to appear with an appropriate message.

    Thanks!

  2. #2
    Registered User
    Join Date
    02-11-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Prevent duplicates Excel user form

    Sorry - second text box is called "txtRCAcode"

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Prevent duplicates Excel user form

    Something like this
    Please Login or Register  to view this content.
    You might prefer to put it in the Before_Update event.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    02-11-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Prevent duplicates Excel user form

    Thanks, will this work for any input i.e. not just a numeric input? Because my txtboxes are not numeric.

    Also, any ideas how, in the instance of a duplicate appearing, the user could choose to accept and the user form would overwrite the data??

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Prevent duplicates Excel user form

    Quote Originally Posted by JSmith1504 View Post
    Thanks, will this work for any input i.e. not just a numeric input? Because my txtboxes are not numeric.
    What happened when you tried it?

    Also, any ideas how, in the instance of a duplicate appearing, the user could choose to accept and the user form would overwrite the data??
    That code detects a duplicate, overwriting a cell with its duplicate doesn't change anything.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Data entry form, how to update / delete / prevent duplicates?
    By SueJB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2012, 08:26 PM
  2. Prevent User Enter Duplicates in Column
    By jade82 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-22-2011, 10:48 PM
  3. User Form to save Form entries & check for duplicates
    By KPK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2010, 05:44 AM
  4. prevent user moving form on screen
    By memphis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2007, 05:23 PM
  5. User Form delete duplicates
    By Loops in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-01-2007, 03:30 AM

Tags for this Thread

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