3-character combinations?

A

Allison

Excel 2003 SP3
Win XP SP2

Is there a quick way to generate a list of all possible 3-character
combinations using the alpha characters A-Z and the numbers 0-9?
 
P

PCLIVE

Probably other ways, but here's one:

- Place A-Z in A1 to A26
- Place 0-9 in A27 to A36

Then you can use this code.

Sub test()

For cOne = 1 To 36
myCell1 = Range("A" & cOne).Value
For cTwo = 1 To 36
myCell2 = myCell1 & Range("A" & cTwo).Value
For cThree = 1 To 36
myCell3 = myCell2 & Range("A" & cThree).Value
Range("B" & Range("B65536").End(xlUp).Row + 1).Value = myCell3
Next cThree
Next cTwo
Next cOne

End Sub


HTH,
Paul
 
P

PCLIVE

Please not that when it gets to the numbers that begin with zero, excel will
treat it as a number and automatically drop the zero.
So "012" would end up being "12". One way that could fix this is to format
column B as text before you run this code.

Glad I could help.
Paul

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top