+ Reply to Thread
Results 1 to 5 of 5

Troubleshooting - Prevent Duplicate Entries From VBA Code

  1. #1
    Registered User
    Join Date
    07-13-2015
    Location
    Chicago, IL
    MS-Off Ver
    2013
    Posts
    14

    Troubleshooting - Prevent Duplicate Entries From VBA Code

    I have some VBA code that I had some help building to generate a random 5-character code with the format: letter-number-letter-number-letter (e.g. d6s8b). The code seems to be working just fine but there should be 1.7 million options and we've created roughly 6,000 codes and we have already come across 8 duplicate codes that were generated. I thought the code would be preventing that, so I'm not sure why this is happening. Anyone's help would be greatly appreciated!

    Our code is below:
    Please Login or Register  to view this content.
    Last edited by mcodden; 05-17-2016 at 11:24 AM.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Troubleshooting - Prevent Duplicate Entries From VBA Code

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    I'll help you if you do that.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    07-13-2015
    Location
    Chicago, IL
    MS-Off Ver
    2013
    Posts
    14

    Re: Troubleshooting - Prevent Duplicate Entries From VBA Code

    Sorry about that! Just adjusted it. Let me know if you're seeing it.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Troubleshooting - Prevent Duplicate Entries From VBA Code

    You're searching Column A to see if the generated code exists there, but then putting the new code into column B. Shouldn't you be searching Column B, like so?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-13-2015
    Location
    Chicago, IL
    MS-Off Ver
    2013
    Posts
    14

    Re: Troubleshooting - Prevent Duplicate Entries From VBA Code

    Yes, that looks like it was it. It looks like it was reformatted to have a spacer column for column A and missed moving over everything to column B so it split everything. I'll move everything back over to column A for consistency and delete the spacer column. Thanks for your help!

+ 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] Prevent duplicate entries
    By Blokeman in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-06-2015, 07:24 PM
  2. Prevent duplicate entries in Data Validation List By code
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-26-2014, 04:56 PM
  3. Prevent duplicate entries in Data Validation List By code
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2014, 04:37 PM
  4. Code to prevent duplicate entries
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-17-2014, 08:49 AM
  5. [SOLVED] Deleting Duplicate Row code troubleshooting
    By ds16 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2012, 04:31 PM
  6. Replies: 0
    Last Post: 06-14-2012, 12:38 PM
  7. code to prevent duplicate entries
    By cart0250 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-19-2006, 02:44 PM

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