View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Protect ALL sheets in one coded macro

Give these a try...

Sub ProtectAll
dim wks as worksheet

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

Sub UnProtectAll
dim wks as worksheet

for each wks in worksheets
wks.unprotect Password:="1234"
next wks
end sub
--
HTH...

Jim Thomlinson


"Corey" wrote:

How can i word a code to protect ALL sheets in a workbook in a single step,
rather than individually?

Sub protect()
' Macro recorded 24-11-2006 by Corey
'
ThisWorkbook.Worksheets("Sheet 10").protect Password:="1234" ' <=== Some
thing like this workbook.worksheets(all).protect password:="1234"
ActiveSheet.protect
End Sub


How can i write this?

Corey....