View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tanya Tanya is offline
external usenet poster
 
Posts: 155
Default Protecting whole workbook

Hi,
I have a workbook with approx 30 worksheets and have protected each
worksheet with the following macro's

Private Sub Protect_Workbook_Click()
'Protect workbook
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.ProtectContents = False Then
ws.Protect ("BBHS")
End If
Next
ActiveWorkbook.Protect (["BBHS"])
Application.ScreenUpdating = True


End Sub

Private Sub UnProtect_Workbook_Click()
'Unprotect workbook
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.ProtectContents = True Then
ws.Unprotect ("BBHS")
End If
Next
ActiveWorkbook.Unprotect (["BBHS"])
Application.ScreenUpdating = True


End Sub

What I am finding is after I run the protection macro is each worksheet
allows you still to click in every cell. My question is, how do get the
macro to protect the worksheets in such a way that you can only click on a
cell that is unprotected?
If anyone could help with this I would be appreciate it greatly.
Regards
Tanya