Public Function IncrémentLettre(LettresInit As String) As String
Application.Volatile
nbcar = Len(LettresInit)
pos = nbcar
For i = 1 To nbcar
If Mid(LettresInit, i, 1) <> "Z" Then
NoFullZ = True
End If
Next i
If NoFullZ = False Then 'permet d'allonger la chaine de caractères d'une lettre
LettresInit = "A" & String(nbcar, "A")
GoTo fin
End If
fin = False
While fin = False
If Mid(LettresInit, pos, 1) <> "Z" Then
LettresInit = Left(LettresInit, pos - 1) & Chr(Asc(Mid(LettresInit, pos, 1)) + 1)
If pos <> nbcar Then
LettresInit = LettresInit & String(nbcar - pos, "A")
End If
fin = True
Else
pos = pos - 1
End If
Wend
fin:
IncrémentLettre = LettresInit
End Function