Macros Serial number generation with repeatability comparison base

K0st4din

Well-known Member
Joined
Feb 8, 2012
Messages
501
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Hi all, after a lot of searching I managed to find something similar on the site that comes close to what I want to do.


But since I don't understand anything, I can't even modify it for my needs, I am asking for your macro help.
I will attach my excel file.
I want to generate random serial numbers and in different situations with different character lengths ie 12 or 14 or 16 or 18.
In cell I2 I have made a drop down menu to choose how many characters to be. In cell J2 - what type should they be (ie Only uppercase letters and numbers, only numbers or lowercase, uppercase and numbers, or some of my choice of selected characters, etc.).
In cell K2, I record how many Countless combinations to generate according to the choices made that start from/in cell A1 to the end (just an example: be it 3, 34569 or 1 million).
Here it comes (and what I was able to find on the site) is to be able in the second worksheet (with some name given by me) to be able to accumulate a base, with already generated combinations, so that there is never repetition in the new ones generated.
Since I have no idea if the macro can add columns, I have made several of the different types of combinations, be it 12, 14, 16 or 18. If after the first column is filled, the macro can add a new column with the search criteria, then it will make no sense for me to put columns for each type (but I leave this as a last touch, to have your say).
I would be extremely grateful if you could help me.
One more thing, in the link where I found a similar solution, there the user requires to have some hyphens, in my case, I don't need them, that is, I need something like this: for example: ODN81T6DRJJY8S or ODN81T6DRJJY8S49 or 068249317896) i.e. is without any signs.
Thanks in advance to each one!
Test serial numbers.xlsm
ABCDEFGHIJKLMNOP
1? CombinationSelect model letters and numbersHow many numbers you need12ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
214ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678998725414ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
316abcdefghijklmnopqrstuvwxyz0123456789
4180123456789
5
6
7
8
9
10
generate numbers
Cells with Data Validation
CellAllowCriteria
I2List=$N$1:$N$5
J2List=$O$1:$O$11



Test serial numbers.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1121212121212121214141414141414141616161616161616
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
base generated numbers
 
If you are going beyond a few million, using a VBA dictionary is going to be increasingly slow, and the Excel workbook is going to get bloated. I'd be looking for non-Excel solutions.

The speed will depend on what the purpose of your codes is. Unique codes are easy and quick to generate if you don't need randomness. But if you want random, for strong cryptography, that will take longer.
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top