Option Explicit
Option Compare Text
Sub BuildKeyCashCode()
Dim GROUP1 As Variant, g1 As Variant
Dim GROUP2 As Variant, g2 As Variant
Dim i As Long
Dim TabCodes(936) As String
Dim Test As String
Test = InputBox('Saisir un code de 2 Digits', 'Unique Alpha Key Generator', 'A9')
GROUP1 = Array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')
GROUP2 = Array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
For Each g1 In GROUP1
For Each g2 In GROUP2
TabCodes(i) = CStr(g1) & CStr(g2)
Cells(i + 1, 1) = g1 & g2 '(Si on veut écrire les code sur une feuille)
i = i + 1
Next g2
Next g1
For i = 0 To UBound(TabCodes)
If Test = TabCodes(i) Then
MsgBox 'NEXT CODE ' & TabCodes(i + 1)
Exit For
End If
Next
End Sub