Sub BoutonPlan()
Dim s As String
s = ActiveSheet.DrawingObjects(Application.Caller).Caption & " "
Cible = s & Range("K4") & " (" & IIf(Left(Range("Q4"), 3) = "Pri", "1", "2") & ")"
Application.DisplayAlerts = False
If Range("K4") = "" Or Range("Q4") = "" Then MsgBox ("Merci de remplir toutes les cases")
If Rep = vbOK Then Exit Sub
If Range("K4") <> "" And Range("Q4") <> "" And ExistWorkSheet(Cible) Then
Worksheets(Cible).Activate
Else
If Range("K4") <> "" And Range("Q4") <> "" And ExistWorkSheet(Cible) = False Then
If MsgBox("Désolé, mais le plan que vous demandez n'existe pas." & Chr(13) & Chr(10) & Chr(13) & Chr(10) _
& "Voulez-vous le créer maintenant ?", vbQuestion + vbYesNo, "INFORMATION moi") = vbYes Then
ActiveWorkbook.Unprotect ""
If InStr(Cible, "SERRE") <> 0 Then
Sheets("PLAN SERRE (vierge)").Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = Cible
If InStr(Cible, "(1)") <> 0 Then
Range("O3") = "Printemps/Eté"
Range("AB3") = Left(Right(Cible, 8), 4)
Else
Range("O3") = "Automne/Hivers"
Range("AB3") = Left(Right(Cible, 8), 4)
End If
Else
Sheets("PLAN POTAGER (vierge)").Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = Cible
If InStr(Cible, "(1)") <> 0 Then
Range("P3") = "Printemps/Eté"
Range("AO3") = Left(Right(Cible, 8), 4)
Else
Range("P3") = "Automne/Hivers"
Range("AO3") = Left(Right(Cible, 8), 4)
End If
End If
End If
End If
End If