PDA

View Full Version : How to Prevent Insertion / Deletion of Worksheet



r_mundhra
08-30-2007, 03:48 AM
Hi All

Is there any method to prevent Insertion of a new worksheet or Deletion of an existing worksheet in a Workbook.

Any help shall be well received.

Thanx/r_mundhra

Bob Phillips
08-30-2007, 04:24 AM
For insert, you could trap the NewSheet event and just delete it again.

Delete is not easy, there is no event to piggy-back onto.

sujittalukde
08-30-2007, 05:31 AM
By protectiting the WB(Tools\Protect\Protect Workbook), insertion/deletion of Wsheet can be done.

r_mundhra
08-30-2007, 10:19 PM
Thanx Sujit for the info...I tried to generate the VBA code with the help of the Macro Recorder. I had put in a password also in the WB(Tools\Protect\Protect Workbook) pop up window. But the Macro (generated from recorded) does not show any password.
Any help on this ...???
Thanx/RM

mdmackillop
08-30-2007, 11:28 PM
Sub DoProtect()
ActiveWorkbook.Protect "password"
End Sub

Sub UnProtect()
ActiveWorkbook.UnProtect "password"
End Sub