Hi
The following code attempts to protect several sheets within a workbook, but only those whose name begins with "Emp".
My problem is that, within the properties, (Name) is "Emp1" "Emp2", etc; but Name (without brackets) is "NN", "SF", Etc. So the code dosen't do anything.
What do i need to change?
Mark
The following code attempts to protect several sheets within a workbook, but only those whose name begins with "Emp".
Code:
Sub ProtectSheets()
For Each sh In Sheets
If Left(sh.Name, 3) = "Emp" Then sh.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next sh
Sheets("Welcome").Range("a1").Select
End Sub
My problem is that, within the properties, (Name) is "Emp1" "Emp2", etc; but Name (without brackets) is "NN", "SF", Etc. So the code dosen't do anything.
What do i need to change?
Mark