+ Reply to Thread
Results 1 to 5 of 5

Hex Code Generator

  1. #1
    Registered User
    Join Date
    08-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    17

    Hex Code Generator

    I need a VBA macro that will do what this formula does, but I need to be able to populate a variable selection of cells:

    =CONCATENATE(DEC2HEX(RANDBETWEEN(0,65535),4),"-",DEC2HEX(RANDBETWEEN(0,65535),4),"-",DEC2HEX(RANDBETWEEN(16384,20479),4),"-",DEC2HEX(RANDBETWEEN(32768,49151),4))

    This generates a random hex code like this: F117-F025-4990-91E4

    Thanks!

    I have this:

    Please Login or Register  to view this content.
    but it re-iterates the same groups over and over.
    Last edited by pwyller; 11-03-2016 at 03:31 PM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Quickie

    This forum can be strict about some of its rules, like putting code within code tags. You risk having your topic locked if you fail to comply.

    At this point, I will say that I did not recreate the problem. It seemed to generate several random sequences without repeats, so I suspect something else is going on. You might need to describe in more detail what is happening and not happening so that we can recreate the problem.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    08-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Quickie

    When you select 32 cells and run the macro, the second 16 are repeats of the first 16 cells.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Quickie

    When I select 32 cells and run the macro, I get 32 unique entries. I tested in a nearby column with =COUNTIF(A$1:A$32,A1) copied down, and all results are 1.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,987

    Re: Quickie

    Please take a moment to re-read forum rule #1 and then amend your opening thread title to something that better explains your problem. Thanks!
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. Just a quickie...Lists!
    By TheRetroChief in forum Excel General
    Replies: 1
    Last Post: 03-04-2009, 06:28 AM
  2. another quickie...
    By lexy1107 in forum Excel General
    Replies: 1
    Last Post: 10-26-2006, 07:47 AM
  3. A real quickie!
    By JamesBurrows in forum Excel General
    Replies: 5
    Last Post: 06-07-2006, 10:45 AM
  4. [SOLVED] A Quickie
    By missymissy in forum Excel General
    Replies: 5
    Last Post: 12-21-2005, 09:26 PM
  5. Quickie on Pivots
    By Soapydux in forum Excel General
    Replies: 4
    Last Post: 11-23-2005, 08:10 PM
  6. [SOLVED] Another quickie...
    By Heatherbelle89 in forum Excel General
    Replies: 2
    Last Post: 07-09-2005, 01:05 AM
  7. TEXTBOX QUICKIE
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2005, 01:07 AM
  8. A Quickie
    By gradientS in forum Excel General
    Replies: 4
    Last Post: 02-16-2005, 05:06 AM

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