Thread: Security
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Security

brad,
try something like this:

Public Const passwrd As String = "mypassword123"
Sub ProtectBook()
Application.ScreenUpdating = False

With ThisWorkbook

'protect workbook
.Protect Password:=passwrd

For Each ws In .Sheets

'protect sheets
ws.Protect Password:=passwrd

Next ws

End With

Application.ScreenUpdating = True

End Sub

--
jb


"Brad" wrote:

I have a workbook with several sheets in it. I want to set the workbook up
where you have to have a password to make changes, but anyone can open the
workbook in read only mode. I know I can set up the worksheets with a
password, but having to protect each sheet is very time consuming. Is there a
way to protect the entire workbook?