View Single Post
  #38   Report Post  
Posted to microsoft.public.excel.misc
sld sld is offline
external usenet poster
 
Posts: 10
Default Can I protect all excel tabs in a file with one password entry

Thanks so much. That worked. it helped me identify which tabs did have a
different password. This is a big help to me.

"Dave Peterson" wrote:

Option Explicit
Sub Unprotect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
On Error Resume Next
ws.Unprotect Password:="123"
On Error GoTo 0
If ws.ProtectContents _
Or ws.ProtectDrawingObjects _
Or ws.ProtectScenarios Then
MsgBox ws.Name & " is still protected"
End If
Next ws
End Sub

SLD wrote:

I copied the unprotect macroe

Sub Unprotect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="123"
Next ws
End Sub

and it is still giving me an error on the 4th line. the passwords are the
same on both macroes.

What am I doing wrong?


--

Dave Peterson