Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a macro button that unprotects each worksheet in my workbook. But I want the user only to have the ability to unprotect each worksheet after a code is entered. The problem is that if the user chooses "Cancel" or the "X" button to close the dialogue box, the worksheets proceed to unprotect. I've taken care of the event that a user enters in an incorrect amount. How do I prevent the user to unprotect each worksheet if they don't have the correct password? Here is my code: Private Sub CommandButton2_Click() Application.ScreenUpdating = False ActiveSheet.Unprotect On Error GoTo Finish For Each ws In ThisWorkbook.Worksheets ws.Unprotect Password:="1111" Next ws Finish: Application.ScreenUpdating = True End Sub Thanks in advance, -- Kent Lysell Financial Consultant Ottawa, Ontario W: 613.948-9557 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Forgotten Password to Unprotect Workbook/sheet | Excel Discussion (Misc queries) | |||
How I unprotect my workbook if I failed to remember my password | Excel Worksheet Functions | |||
How do I unprotect a workbook without the password? | Excel Discussion (Misc queries) | |||
Record a macro which enters a password to unprotect a workbook | Excel Programming | |||
Unprotect workbook without password | Excel Programming |