Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for your response Mike
Your solution didn't quite work as well as expected. Kind Regards "Mike H" wrote: Very minor change to your code will do the trick:- 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") ActiveSheet.EnableSelection = xlUnlockedCells End If Next ActiveWorkbook.Protect (["BBHS"]) Application.ScreenUpdating = True Mike End Sub "Tanya" wrote: 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protecting a workbook | Excel Worksheet Functions | |||
protecting workbook | Excel Discussion (Misc queries) | |||
Protecting a workbook | Excel Discussion (Misc queries) | |||
Protecting a workbook | Excel Discussion (Misc queries) | |||
Protecting Workbook!.. | Excel Worksheet Functions |