Home |
Search |
Today's Posts |
#12
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Macro worked great, but the person opening the file can just go to
tools-protection-unprotect sheet and they don't even have to enter a password to unprotect it. How does the password I input in the macro become 'activated' so to speak? Do I have to password protect the workbook somehow, because the password that I coded into the macro, I never typed in anywhere else in the file...? Thanks! "Harald Staff" wrote: Hi Not without macro code. Here it is: Sub LockEm() Dim i As Long Dim PW As String Dim WS As Worksheet PW = InputBox("Password:") On Error GoTo MyErr For Each WS In ActiveWorkbook.Worksheets WS.Protect (PW) Next MsgBox i & " errors while protecting", vbInformation Exit Sub MyErr: i = i + 1 Resume Next End Sub Sub UnLockEm() Dim i As Long Dim PW As String Dim WS As Worksheet PW = InputBox("Password:") On Error GoTo MyErr For Each WS In ActiveWorkbook.Worksheets WS.Unprotect (PW) Next MsgBox i & " errors while unprotecting", vbInformation Exit Sub MyErr: i = i + 1 Resume Next End Sub HTH. Best wishes Harald "Adam" skrev i melding ... I have a workbook with 50 sheets. I would like to protect all of these sheets with the same password at the same time. i.e. i do not want to protect the workbook but every single sheet and I don't want to go through every sheet protecting it. Is this possible? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying multiple sheets from one book 2 another and undertake spec | Excel Discussion (Misc queries) | |||
calculating excel spreadsheet files for pensions and life insurance (including age calculation sheets) | Excel Worksheet Functions | |||
Protection and Hiding Sheets | Excel Discussion (Misc queries) | |||
Changing password protection on sheets | Excel Discussion (Misc queries) | |||
Multiple sheets selected | Excel Discussion (Misc queries) |