View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Protect worksheet from deletion

Protect the workbook and provide a macro that unprotects the workbook, adds a
sheet and then reprotects the workbook.

Option Explicit
Sub testme02()
With ThisWorkbook
.Protect Password:="hi there"
.Worksheets.Add
.Protect Structu=True, Windows:=False, Password:="hi there"
End With
End Sub

Just a warning: workbook protection like this is easily broken.


Remember to protect the project in the VBE, else others will see the password in
the code.

Tools|VBAProject Properties|Protection tab
Lock the project for viewing and give it a memorable password.



Richard wrote:

Is there a way to password protect one worksheet from being deleted, while
allowing users to add new worksheets?

Failing that, is there a way to password protect one worksheet from being
deleted, while allowing a macro program to add a new sheet?

--
Richard


--

Dave Peterson