Sub ajout_feuille()
Dim Nom As String, i As Byte, Verif As Boolean, MSG As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do
Verif = False
Nom = InputBox("Définissez le nom de votre nouvelle feuille", "Ajout nouvelle feuille")
Nom = UCase(Nom)
If Nom = "" Then Exit Sub
MSG = ""
For i = 1 To Sheets.Count
If Sheets(i).Name = Nom Then
MSG = "la feuille " & Nom & " existe déjà, veuillez choisir un autre nom"
Verif = True
End If
Next
If Verif = False Then
If Len(Nom) > 30 Then
MSG = "Le nom est trop long, veuillez choisir un autre nom"
Verif = True
ElseIf InStr(Nom, "/") Or InStr(Nom, "*") Or InStr(Nom, "?") Or InStr(Nom, ":") Or InStr(Nom, "[") Or InStr(Nom, "]") Then
MSG = "Les caractères / * ? : [ ] sont interdits, veuillez choisir un autre nom"
Verif = True
End If
End If
If Verif = True Then MsgBox MSG
Loop While Verif = True
ThisWorkbook.Worksheets("EXEMPLAIRE").Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = Nom
ActiveSheet.ListObjects(1).Name = Trim(Replace(Nom, " ", "_"))
Application.ScreenUpdating = True
End Sub