View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
xrbbaker xrbbaker is offline
external usenet poster
 
Posts: 35
Default Macro to protect multiple sheets?

Never mind. I found my error. Sorry to bother. Thanks for the help.

Russ

"Duke Carey" wrote:

try
Dim ws as worksheet
for each ws in thisworkbook.worksheets
ws.Protect Password:="mypassword", DrawingObjects:=True,
Contents:=True, Scenarios:=True
ws.EnableSelection = xlUnlockedCells
next ws



"Stilla" wrote:

Duke - Fantastic! it WORKS!! One small glitch...

When I protect, I'm still able to select locked cells... how do I modify
this so that the user is only able to select unlocked cells on a protected
sheet?

Thanks again.

"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
__________________________