Private Sub Workbook_Open()
For n = 1 To 100 '100= maximum de copies (si plus envisagées augmenter)
x = MsgBox("Voulez vous créer une nouvelle facture ?", vbYesNo)
If x = 6 Then
Do
nom = InputBox("Quel est le nom du client ?")
If nom = "" Then Exit Sub
On Error Resume Next
Set sht = Sheets(nom & " (FS)")
If Err <> 0 Then
Sheets(Array("Facture modèle", "Détails modèle")).Copy Before:=Sheets("test")
ActiveSheet.Name = nom & " (FS)"
Sheets(ActiveSheet.Index + 1).Name = nom & " (Détails)"
Err.Clear: Exit Do
Else
MsgBox "Une facture de ce nom existe déjà !"
End If
Loop
Else
Exit Sub
End If
Next n
End Sub