Option Explicit
Private Wsh As Worksheet
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
Set Wsh = ThisWorkbook.Worksheets(CStr(Target(1, 1).Value))
If Err Then Set Wsh = Nothing
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NouvNom As String
If Wsh Is Nothing Then Exit Sub
NouvNom = Target(1, 1).Value
On Error Resume Next
Wsh.Name = NouvNom
If Err Then
MsgBox "Err " & Err & " en tentant de renommer '" & NouvNom & "' la feuille '" & _
Wsh.Name & "'." & vbLf & Err.Description, vbCritical, "Renommer feuille"
Application.EnableEvents = False
Target(1, 1).Value = Wsh.Name
Application.EnableEvents = True
End If
End Sub