Should the code contain just numbers? Just Letters? A mixture? Are the first few letters and the last few numbers? Is the code completely random? Are duplicate codes acceptable?
There isn't very much information to go on to generate a solution for.
If you just want a random set of numbers extended to 13 digits, then this would work:
----------------------------------------------------
Dim iCnt As Integer, sCode As String
For iCnt = 1 to 13
sCode = sCode & Int((Rnd * 10)) 'Concatenates random number between 0 and 9
Next
MsgBox "The generated code is: " & sCode
----------------------------------------------------
The above doesn't check to see if there was a duplicate. You'd have to check the result against a list for that.
If you are looking for anything more specific then more information on what is desired is needed.
|