Need Macro to Protect worksheets that haven't been created yet

taj2012

New Member
Joined
Jul 29, 2014
Messages
7
I have a Macro in place that automatically creates a duplicate of a worksheet. When I create a duplicate, the worksheet protection settings go away. Is there a Macro that would automatically protect a newly created worksheet without manually protecting it?
 

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
Add this code to your workbook's ThisWorkbook code module:

Code:
Private Sub Workbook_NewSheet(ByVal Sh as Object) 
 Sh.Password = "mysheetpassword"    'put your password here
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,108,982
Messages
5,526,055
Members
409,681
Latest member
marnu70

This Week's Hot Topics

Top