Question: Protecting workbook structure will prevent a user from deleting sheets. But how could I (using VBA) prevent a user from deleting a *particular* sheet I designate? I've seen examples where an active sheet is prevented from deletion by

```
Set mymenubar = CommandBars.ActiveMenuBar
mymenubar.Controls("Edit").Controls("Delete sheet").Visible = False

```

in its `Worksheet_Activate` event but that of course only works if the sheet is activated.  

Is there a way to prevent a sheet from being deleted whether active or no?  

For clarity: I'm fine with the user deleting some sheets, just not a couple of particular sheets.  

So protecting workbook structure won't work.

Answer: 
I can prevent a sheet from being deleted via the Worksheet\_BeforeDelete Event as follows:

```
Private Sub Worksheet_BeforeDelete()

    Call ThisWorkbook.Protect("password")

    Call MsgBox("This sheet cannot be deleted.", vbExclamation)

End Sub

```

This protects all sheets from being deleted, however if you add some event code on the ThisWorkbook module like the following :

```
Private Sub Workbook_SheetActivate(ByVal Sh As Object)

    Call ThisWorkbook.Unprotect("password")

End Sub

```

I will then be able to delete any other sheet as soon as it is selected.

Bear in mind, you will lose copy and paste functionality between pages due to the page unlocking when it is selected.
Here is another answer from mine base on the idea of @Jean-François Corbett
You can use 'Protect WB Structure' and Event 'Workbook\_SheetBeforeDelete' to achieve this.
The result is that an dialog will pop up said "Workbook is protected and cannot be changed."

```
Private Sub zPreventWShDel(WSh As Worksheet, Protection As Boolean)
Dim zPassword As String: zPassword = ""
Dim zWB As Workbook
Set zWB = WSh.Parent
If Protection Then
    zWB.Protect zPassword, Protection
Else
    zWB.Protect zPassword, Protection
End If

'Stop
End Sub

Private Sub Workbook_SheetBeforeDelete(ByVal Sh As Object)
Call zPreventWShDel(Sh, True)
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Call zPreventWShDel(Sh, False)
End Sub

```

Do not Call the code on Sheet Deactivation like below. Because it will deactivate it. Sequence of running is Event\_SheetBeforeDelete -> Event\_SheetDeactivate.

```
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Call zPreventWShDel(Sh, False)
End Sub

```