ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   3-character combinations? (https://www.excelbanter.com/excel-programming/418779-3-character-combinations.html)

Allison

3-character combinations?
 
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?



PCLIVE

3-character combinations?
 
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

--

"Allison" wrote in message
...
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?





Allison

3-character combinations?
 
This worked great. Thank you very much.

Allison

"PCLIVE" wrote:

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

--

"Allison" wrote in message
...
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?






PCLIVE

3-character combinations?
 
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

--

"Allison" wrote in message
...
This worked great. Thank you very much.

Allison

"PCLIVE" wrote:

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

--

"Allison" wrote in message
...
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?









All times are GMT +1. The time now is 10:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com