View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AMK4[_2_] AMK4[_2_] is offline
external usenet poster
 
Posts: 1
Default Problems with Protect Method


- Excell 2003, SP2 -

I have a workbook that contains several sheets. Only the first one has
been protected. Through VBA, I'm trying to protect all the sheets, so I
do the following:


Code:
--------------------
Sub LockAll()
Dim wSheet As Worksheet
Worksheets(1).Unprotect Password:="passwd_string"
For Each wSheet In Worksheets
wSheet.Protect Password:="passwd_string"
Next
End Sub
--------------------

Can anyone tell me why it successfully Unprotects and Re-Protects ONLY
the first sheet and doesn't Protect any of the other ones? (Remember,
the other sheets don't start out Protected, only the first one does.)


--
AMK4
------------------------------------------------------------------------
AMK4's Profile: http://www.excelforum.com/member.php...o&userid=19143
View this thread: http://www.excelforum.com/showthread...hreadid=501872