Function FeuilleExiste(NomFeuille As String) As Boolean
FeuilleExiste = False
For Each ws In ActiveWorkbook.Sheets
If ws.Name = NomFeuille Then
FeuilleExiste = True
Exit Function
End If
Next ws
End Function
Sub Copyrenameworksheet()
'Updateby Extendoffice
Dim ws As Worksheet
Set wh = Worksheets(ActiveSheet.Name)
NomFeuille = wh.Range("A2").Value
If NomFeuille = "" Then Exit Sub
If FeuilleExiste(CStr(NomFeuille)) Then
MsgBox "la feuille """ & NomFeuille & """ existe déjà"
Exit Sub
End If
ActiveSheet.Copy After:=Worksheets(Sheets.Count)
ActiveSheet.Name = NomFeuille
wh.Activate
End Sub