View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Protecting Multiple Worksheets

does sh.protect "ron" set the password

Yes


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



wrote in message ...
Ron!

Thank you - this worked perfectly - you little star!
Quick question - does sh.protect "ron" set the password?
Thanks
Sam
-----Original Message-----
Try this Sam

Sub prot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ron"
Next sh
Application.ScreenUpdating = True
End Sub

Sub unprot()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Sam A" wrote in

message ...
Hi
I need to protect multiple worksheets to lock cells.

Only
way I can see to do this is to go into individual sheets
and do this. The 'protect sheet' option is greyed out
when multiple sheets are open.
Is it therefore possible to run a macro to protect /
unprotect worksheets with a password?
Thanking you in advance. Sam



.