- Hot Topics
Excel apply codes to all new sheets added
Code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Sheets("Sheet1").Range("B3").Value >= -Date And Sheets("Sheet1").Range(" B3").Value <= Date - 1 Then ActiveWorkbook.Unprotect Password:="password" MsgBox "This workbook is locked, please contact [email protected]" Else 'MsgBox "unlocked" End If End Sub Currently the code is working in Sheet1 only. How do I enter it in a module so that it applies to all new sheets added on the workbook?
This question generated 20 answers. To proceed to the answers, click here.
This thread is current as of July 25, 2014.
For more resources for Microsoft Excel:
This article includes the following tags:
- Microsoft Excel