Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protect Excel sheets with Password Using VBA
Is there a way to prompt for a password that covers all sheets when using VBA
to protect multiple sheets in a workbook? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protect Excel sheets with Password Using VBA
This'll protect all the unprotected worksheets with the same password:
Option Explicit Sub testme01() Dim myPwd As String Dim wks As Worksheet myPwd = InputBox(prompt:="what's the password, kenny?") If Trim(myPwd) = "" Then Exit Sub End If For Each wks In ThisWorkbook.Worksheets If wks.ProtectContents _ Or wks.ProtectDrawingObjects _ Or wks.ProtectScenarios Then 'already protected Else wks.Protect Password:=myPwd End If Next wks End Sub Iain wrote: Is there a way to prompt for a password that covers all sheets when using VBA to protect multiple sheets in a workbook? -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protect Excel sheets with Password Using VBA
Thanks Dave - really appreciate the help.
"Dave Peterson" wrote: This'll protect all the unprotected worksheets with the same password: Option Explicit Sub testme01() Dim myPwd As String Dim wks As Worksheet myPwd = InputBox(prompt:="what's the password, kenny?") If Trim(myPwd) = "" Then Exit Sub End If For Each wks In ThisWorkbook.Worksheets If wks.ProtectContents _ Or wks.ProtectDrawingObjects _ Or wks.ProtectScenarios Then 'already protected Else wks.Protect Password:=myPwd End If Next wks End Sub Iain wrote: Is there a way to prompt for a password that covers all sheets when using VBA to protect multiple sheets in a workbook? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
password protect the button in Excel? | Excel Discussion (Misc queries) | |||
OT I would want protect my sheets of excel from a "password recovery" software... How? | Excel Worksheet Functions | |||
password protect sheets | Excel Worksheet Functions | |||
Excel password but cant hide the sheets before entering password | Excel Programming |