Option Explicit
Const Plage = "A1:A11,C1:C11"
Const carac = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ"
Sub Aleatoire()
Dim xrg As Range, cel As Range, x
Dim an, op, tail, i&, max&, total&, prefix, dico
Application.ScreenUpdating = False
Set xrg = Range(Plage): total = xrg.Count
an = [g1]: op = [g2]: tail = [g3]
max = Len(carac): prefix = an & op
Set dico = CreateObject("scripting.dictionary")
Randomize
Do
x = prefix
For i = 3 To tail
x = x & Mid(carac, 1 + (Int((Rnd * 1000000)) Mod max), 1)
Next i
dico(x) = ""
Loop Until dico.Count = total
On Error Resume Next
For Each cel In xrg
If cel <> "" Then dico.Remove cel.Value
Next cel
On Error GoTo 0
For Each cel In xrg
If cel = "" Then
x = dico.keys()(0): cel = x: cel.Offset(, 1) = x: dico.Remove x
End If
Next cel
MsgBox "Terminé!"
End Sub