protect workbook

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

Hello.

I have a file that has 7 sheets. I want to protect it so that it can be
viewed but not edited.
I know how to do this by sheet but when I do 'protect workbook' it makes no
difference. how do you do it in one go rather than going into every sheet
and protecting it and then having to unprotect 7 times when I'm using it.

Thank you
 
Hello.

I have a file that has 7 sheets. I want to protect it so that it can be
viewed but not edited.
I know how to do this by sheet but when I do 'protect workbook' it makes no
difference. how do you do it in one go rather than going into every sheet
and protecting it and then having to unprotect 7 times when I'm using it.

Thank you

Use macros to protect and unprotect all the sheets. Maybe...

Public Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim Sht As Object
On Error Resume Next
For Each Sht In ThisWorkbook.Sheets
Sht.Protect "password" 'change to your password
Next Sht
End Sub

Public Sub UnProtectAllSheets()
Application.ScreenUpdating = False
Dim Sht As Object
On Error Resume Next
For Each Sht In ThisWorkbook.Sheets
Sht.Unprotect "password" 'change to your password
Next Sht
End Sub
 
Thank you I'll try that

Ken Johnson said:
Use macros to protect and unprotect all the sheets. Maybe...

Public Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim Sht As Object
On Error Resume Next
For Each Sht In ThisWorkbook.Sheets
Sht.Protect "password" 'change to your password
Next Sht
End Sub

Public Sub UnProtectAllSheets()
Application.ScreenUpdating = False
Dim Sht As Object
On Error Resume Next
For Each Sht In ThisWorkbook.Sheets
Sht.Unprotect "password" 'change to your password
Next Sht
End Sub
 
Back
Top