Protect sheets in one go

M

mohavv

Hi,

Is there a way to protect all the sheets in a workbook in one go?
I've got 17-19 sheets (it varies).

I could create a macro, but how to handle the different number of
sheets?

Cheers,

Harold
 
D

Don Guillett

something like
for each ws in worksheets
if ws.name<>"notthisone" _
and ws.name <>"notthisoneeither" then
end if
ws.protect
next ws
 
J

Jim Thomlinson

This will do them all...

Sub ProtectAll()
dim wks as worksheet

for each wks in worksheets
wks.protect Password:="Tada"
next wks
end sub
 
J

Jim Thomlinson

or perhaps...

for each ws in worksheets
if ws.name<>"notthisone" _
and ws.name <>"notthisoneeither" then
ws.protect
end if
next ws
 
M

mohavv

This will do them all...

Sub ProtectAll()
dim wks as worksheet

for each wks in worksheets
 wks.protect Password:="Tada"
next wks
end sub
--
HTH...

Jim Thomlinson







- Show quoted text -

Tx! works fine!
 
Top