BobbyConkers
New Member
- Joined
- Mar 26, 2014
- Messages
- 33
Good day all.
I have a spreadsheet with 80 (and growing) tabs. When this file is distributed, I would like all tabs to be protected with a password.
I have VBA which does this:
Dim wSheet As Worksheet
Dim Pwd As String
Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
For Each wSheet In Worksheets
wSheet.Protect Password:=xyz
Next wSheet
This works, but it does not actually assign that password to those sheets, so effectively, anyone can simply click "Unprotect Sheet" and they're in! This password simply stops people protecting all, which isn't especially useful.
What I need is to protect all those worksheets with a password which is required when unprotecting. The same password for all sheets is sufficient. Is this possible please?
(If so, another VBA which could be used to unprotect all, based on those passwords, would also be useful!)
Many thanks in advance.
I have a spreadsheet with 80 (and growing) tabs. When this file is distributed, I would like all tabs to be protected with a password.
I have VBA which does this:
Dim wSheet As Worksheet
Dim Pwd As String
Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
For Each wSheet In Worksheets
wSheet.Protect Password:=xyz
Next wSheet
This works, but it does not actually assign that password to those sheets, so effectively, anyone can simply click "Unprotect Sheet" and they're in! This password simply stops people protecting all, which isn't especially useful.
What I need is to protect all those worksheets with a password which is required when unprotecting. The same password for all sheets is sufficient. Is this possible please?
(If so, another VBA which could be used to unprotect all, based on those passwords, would also be useful!)
Many thanks in advance.