View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul B Paul B is offline
external usenet poster
 
Posts: 709
Default Protect ALL sheets in one coded macro

Corey,

Sub Protect_All_Sheets()

Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets

ws.Protect password:="1234"

Next ws

End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"Corey" wrote in message
...
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....