+ Reply to Thread
Results 1 to 8 of 8

Duplicate VBA code not working!

  1. #1
    Registered User
    Join Date
    10-18-2016
    Location
    Frankfurt, Germany
    MS-Off Ver
    2010
    Posts
    82

    Exclamation Duplicate VBA code not working!

    Hi, I'm at the final hurdle of completing my userform and I need a check for duplicate entries.

    The code I am using is not working! Regardless of what reference I wish to submit on the form it says it's a duplicate when it's not! Please help!

    The duplicate check code is highlighted in bold red - have I placed it in the wrong part of the code or is it just wrong altogether??


    When the form is filled out and user clicks OK I have a few of these so empty fields are not added.

    Please Login or Register  to view this content.
    Straight after that I have

    Please Login or Register  to view this content.
    Finally the OK button to add the entry to the sheet

    Please Login or Register  to view this content.
    I can post the full code too if that helps, but thought it was too long and repetitive of what I posted above. Thank you in advance!
    Last edited by manny88; 06-18-2020 at 07:42 AM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Duplicate VBA code not working!

    Your match function will return an error if it doesn't find the textbox value in the list.
    Rory

  3. #3
    Registered User
    Join Date
    10-18-2016
    Location
    Frankfurt, Germany
    MS-Off Ver
    2010
    Posts
    82

    Re: Duplicate VBA code not working!

    Quote Originally Posted by rorya View Post
    Your match function will return an error if it doesn't find the textbox value in the list.
    Hi Rory,

    Thanks for the quick response. That makes sense why it's telling me any gibberish I enter is a duplicate.

    What can I do to change it so that it only looks for what is already in the worksheet "Admin"? Also, is the placement fine for it to work after?

    Apologies - I am learning most of this on the job, so I may be asking obvious questions
    Last edited by manny88; 06-18-2020 at 07:56 AM.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Duplicate VBA code not working!

    (removed as too late …)

  5. #5
    Registered User
    Join Date
    10-18-2016
    Location
    Frankfurt, Germany
    MS-Off Ver
    2010
    Posts
    82

    Re: Duplicate VBA code not working!

    Quote Originally Posted by Marc L View Post
    (removed as too late …)
    I'm not sure what this means.

    FYI - Crossposted on MrExcel for help as I am in need of urgent help with this. Sorry again

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Duplicate VBA code not working!

    Add the word Not in front of IsError and the code should do what you want.

  7. #7
    Registered User
    Join Date
    10-18-2016
    Location
    Frankfurt, Germany
    MS-Off Ver
    2010
    Posts
    82

    Re: Duplicate VBA code not working!

    I googled this some more after posting and tried adding Not. Including this posted the duplicate text into the spreadsheet, so unfortunately it did nothing

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Duplicate VBA code not working!

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here. (Provide the link to you post, don't just mention that it's cross-posted. We'll never find it.)

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. [SOLVED] Why the code is not working to avoide duplicate numbers?
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-13-2017, 09:30 PM
  2. [SOLVED] Pattern Building VBA Code - Working code, would like to use cleaner code
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2015, 03:05 PM
  3. [SOLVED] Code to check cell against a list for duplicate, if no duplicate, post to bottom of list..
    By wannabacat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2015, 11:42 AM
  4. [SOLVED] Vba code working in workbook module but not working from personal.xlb
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-19-2014, 05:47 AM
  5. Replies: 2
    Last Post: 12-17-2013, 11:51 AM
  6. Help with re-working macro code to 'throw out' duplicate values.
    By pwyller in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-14-2012, 01:30 PM
  7. If Next not working with duplicate values
    By mdnghtsnpr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2010, 12:24 PM

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