Macro to protect multiple sheets?
Duke,
Pardon my jump in, but I have the exact same need. I tried your solution
but it seems only to work on the first worksheet. Any idea why that may be?
Thanks - Russ
Sub protectit()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ActiveSheet.Protect Password:="myPW", DrawingObjects:=True,
Contents:=True, Scenarios:=True
Next ws
End Sub
"Duke Carey" wrote:
Dim ws as worksheet
for each ws in thisworkbook.worksheets
ws.Protect Password:="mypassword", DrawingObjects:=True,
Contents:=True, Scenarios:=True
next ws
"Stilla" wrote:
Hello! Thanks in advance for your help.
How can I modify the macro (below line) I recorded to protect a sheet so
that I can use it multiple sheets at once. I have a workbook with 20 tabs.
I'd like to be able to protect and unprotect all sheets at once.
_________________________
PROTECTSHEET Macro
Keyboard Shortcut: Ctrl+p
ActiveSheet.Protect Password:="mypassword", DrawingObjects:=True,
Contents:=True, Scenarios:=True
__________________________
|