Function AvCodage(xPlage As Range)
Dim Lettre(), ChiffreLet()
Dim Chiffre(), LettreCh()
Dim xLettre As Variant
Dim xResult As Variant, xCodFin As Variant, i%, j%
Lettre = 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")
ChiffreLet = Array(25, 24, 24, 22, 21, 20, 19, 18, 17, 16, 15, _
14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
Chiffre = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
LettreCh = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")
'----------- Traitement ----------
For F = 1 To xPlage.Count
xCodDep = xPlage(F) 'Range("B" & F)
For G = 1 To Len(xCodDep)
xLettre = Mid(xCodDep, G, 1)
If IsNumeric(xLettre) Then
'---- Traitement du numérique ----
For i = 0 To 9
If Val(xLettre) = Chiffre(i) Then
xResult = LettreCh(i)
End If
Next i
Else
'--- Traitement de Alphabétique --
For j = 0 To 25
If xLettre = Lettre(j) Then
xResult = ChiffreLet(j)
End If
Next j
End If
xCodFin = xCodFin & xResult
Next G
Next F
AvCodage = xCodFin
End Function