Passowrd Protecting

G

Guest

I currently have 8 sheets within a workbook which are protected, on each
sheet I have some locked and unlocked cells. Each worksheet is for each day
of the week plus a totals sheet, therefore the layout for each sheet is
identical. At present If I need to make an amendment to any of the locked
cells I have to unprotect every sheet make the change and then proect every
sheet.

Is there anyway of proecting ALL the sheets at once and unprotecting them
all at once as this would reduce the time it takes.

Regards
The Rook
 
D

Don Guillett

try a loop something like

for each ws in worksheets
If ws.Name <> "Sheet1" Then do your thing
Next ws
 
C

Chip Pearson

You would need to use a VBA procedure:


Sub ProtectAll()
Dim SH As Object
For Each SH In ThisWorkbook.Sheets
SH.Protect
Next SH
End Sub

Sub UnProtectAll()
Dim SH As Object
For Each SH In ThisWorkbook.Sheets
SH.Unprotect
Next SH
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
G

Guest

Chip,

That worked a treat, but I forgot ti include that I want to use a password.

Can this be done?
 
C

Chip Pearson

Use code like

Sub ProtectAll()
Dim SH As Object
For Each SH In ThisWorkbook.Sheets
SH.Protect Password:="the_password"
Next SH
End Sub

Sub UnProtectAll()
Dim SH As Object
For Each SH In ThisWorkbook.Sheets
SH.Unprotect Password:="the_password"
Next SH
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top