How to randomly generate 16 digit numbers?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to generate 16 digit numbers using Rnd function starting say 4126 or
whatever, and upto 1000 times or whatever the user selects.
eg. Start Number: 4126
How Many: 1000
result: 4126236412652736
4126358645126845 and so on
Thanks
 
Hi Dave,

AFAIK VBA doesn't have a data type that works comfortably with 16 digit
numbers. You can construct a string of 16 pseudo-random digits with an
expression like this:

strRandom = Format(Int(Rnd()*10000), "0000") _
& Format(Int(Rnd()*10000), "0000") _
& Format(Int(Rnd()*10000), "0000") _
& Format(Int(Rnd()*10000), "0000")
 
Back
Top