Bonjour,
En VBA, via cette fonction :
Public Function Decale_Chiffre_Cesar(sTe As String, Nbre As Long) As String
Dim vT, sG As String, st As String, i As Long, bA As Byte
Const MAJ As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Const NL As Byte = 26
Const DMA As Byte = 65 - NL
Const DMI As Byte = 97 - NL
st = sTe
If Nbre < NL And Nbre > NL * -1 Then
sG = String$(NL * 4, " ")
LSet sG = MAJ & MAJ & MAJ
vT = Split(StrConv(sG, vbUnicode), Chr(0))
For i = 1 To Len(st)
If Mid$(st, i, 1) Like "[a-zA-Z]" Then
bA = Asc(Mid$(st, i, 1))
If Mid$(st, i, 1) = vT(bA - DMA) Then
Mid$(st, i) = vT(bA - DMA + Nbre)
Else
Mid$(st, i) = LCase$(vT(bA - DMI + Nbre))
End If
End If
Next i
End If
Decale_Chiffre_Cesar = st
End Function
Sous l'éditeur VBE : Insertion/Module, y coller le code ci-dessus.
Une fois la fonction en place dans VBE, dans la feuille, par exemple, en B9 : insérer la formule =Decale_Chiffre_Cesar(B8;2)