Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim ws As Worksheet
Dim Nom As String
Dim Prenom As String
Dim Age As Date
Prenom = Worksheets("GENERAL").Cells(Target.Row, 2).Value
Age = Worksheets("GENERAL").Cells(Target.Row, 4).Value
If Target.Column <> 1 Or Target.Value = "" Then Exit Sub
Cancel = True
Application.ScreenUpdating = False
Nom = Target.Value
On Error Resume Next
Set ws = Sheets(Nom)
On Error GoTo 0
If ws Is Nothing Then
With Sheets("Modèle")
.Visible = True
.Copy After:=Sheets(Sheets.Count)
.Visible = False
End With
With Sheets(Sheets.Count)
.Name = Nom + "_" + Prenom + IIf(Age = 0, "", "_" + Format(Age, "yyyy"))
.Cells(1, 1).Value = Nom
End With
Else
Call MsgBox("La feuille avec ce nom existe déja.", vbCritical, "Impossible de créer une feuille")
Exit Sub
End If
Application.ScreenUpdating = True
End Sub