Bonsoir,
Bonsoir Amadéus
Dans ce fichier, tu as tout ce qu'il faut pour tes 2 problèmes (interdire suppression, et interdire ajout de feuilles)
Le code :
Dans le ThisWorkbook :
Private Sub Workbook_Activate()
InterdireSupFeuil
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
RetablirSupFeuil
End Sub
Private Sub Workbook_Deactivate()
RetablirSupFeuil
End Sub
Private Sub Workbook_NewSheet(ByVal Sh As Object)
Application.ScreenUpdating = False
If Sheets.Count > 10 Then
MsgBox "Vous ne pouvez pas insérer de nouveaux onglets", vbc + vbOKOnly + vbExclamation, "Opération interdite"
Application.DisplayAlerts = False
Sh.Delete
Application.DisplayAlerts = True
End If
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_Open()
InterdireSupFeuil
End Sub
Et dans un module standard :
Sub InterdireSupFeuil()
Dim c As CommandBarControl
For Each c In Application.CommandBars.FindControls(ID:=847)
c.OnAction = "SupFeuil"
Next c
End Sub
Sub SupFeuil()
MsgBox "Vous ne pouvez pas supprimer cette feuille!", vbc + vbOKOnly + vbExclamation, "Opération interdite"
End Sub
Sub RetablirSupFeuil()
Dim c As CommandBarControl
For Each c In Application.CommandBars.FindControls(ID:=847)
c.OnAction = ""
Next c
End Sub
Bonne soirée