+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 & 2010 Static Random Unique Alphanumeric string across multiple sheets

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1

    Excel 2007 & 2010 Static Random Unique Alphanumeric string across multiple sheets

    Hi,

    I am new to VBA and wanted to make an excel file. I need to create an excel file with 15 sheets and each sheet will have 6 columns;

    1. Member ID (Mandatory)
    2. First Name (Mandatory)
    3. Last Name (Mandatory)
    4. Gender (Mandatory)
    5. Date of Birth (MM/DD/YY) format (Mandatory)
    6. Member Code

    All fields will be blank initially. Once a user enters/selects a value in the Member ID, First Name, Last Name, Gender & Date of Birth column, a Unique, Random, 15 character alphanumeric string (only upper case alphabets, no lower case alphabets) should be generated in the Member Code column.

    The value should not change even when data for next row is entered. After saving the excel workbook and re-opening it, it should retain all the unique random 15 character strings generated.

    I found a good function that can create a 15 character string as required, but I am unable to make it unique within the sheet & across the sheets in a workbook.

    The function is taken from this site
    http://www.ozgrid.com/forum/showthread.php?t=19314

    I modified the function slightly to suit my needs and changed it to this

    Please Login or Register  to view this content.

    I can throw in some conditional statements to not run this script if the previous columns are empty, but I am unable to make it unique.

    Kindly help me out here.

    Thanks in anticipation !!!
    Vignan
    Last edited by svignan; 01-22-2013 at 06:31 AM.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel 2007 & 2010 Static Random Unique Alphanumeric string across multiple sheets

    Hi,

    A very minor change that will check to make sure that the generated code is unique prior to printing it to the worksheet.

    Please Login or Register  to view this content.
    Additionally you should be calling this from a sub and leaving only the values or the code could change if someone accidentally clicks inside the cell.

    Hope this helps.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

+ 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