generate 10 digit unique number using VBA ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahulrhegde
    New Member
    • Sep 2010
    • 4

    #1

    generate 10 digit unique number using VBA ?

    Generate 10 digit unique number using VBA ?

    I used the Unix -Time formula

    Now the problem with this is 2 person from different computer can generate number at same sec then this will fail
    Because the 10 digit unque number genrated by Unix time is the time difference between the present time and Unix eco time.
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Do you want to use the unix timestamp or just a random number?
    There is always Rnd() and custom random functions

    Comment

    • rahulrhegde
      New Member
      • Sep 2010
      • 4

      #3
      I cant use Rnd() function because this does not guaranty me unique number whenever I generate a number.

      I will tell u the scenario I have a doc whenever i open this a macro pop up to generate a unique 10 digit number . this doc may be on several machines anyone who uses this doc should get a unique number

      Comment

      • rahulrhegde
        New Member
        • Sep 2010
        • 4

        #4
        Thank You for your response

        Comment

        • code green
          Recognized Expert Top Contributor
          • Mar 2007
          • 1726

          #5
          So it is unique rather than random.
          You could get millisecond accuracy using the timer and the current time in seconds, not 100% guarantee of unique buts the odds of duplication must be huge.

          The only true guarantee of a unique number is generating your own incremetal index

          Comment

          • rahulrhegde
            New Member
            • Sep 2010
            • 4

            #6
            Please could help me to find milli sec in VBA

            Comment

            • code green
              Recognized Expert Top Contributor
              • Mar 2007
              • 1726

              #7
              It is a VB function timer()

              Comment

              Working...