ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I lock several sheets (https://www.excelbanter.com/excel-discussion-misc-queries/166356-how-do-i-lock-several-sheets.html)

Jane

How do I lock several sheets
 
I have a spredsheet with 100 identical sheets, and I like to lock/protect all
the sheets. Is it possible to do this in a simple way instead of that I have
to lock each of them.
--
Jane

Bernard Liengme

How do I lock several sheets
 
This pair of subroutines with protect/Unprotect all the worksheets in the
current book. Unfamiliar with VBA? It really can be fun. See David
McRitchie's site on "getting started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Jane" wrote in message
...
I have a spredsheet with 100 identical sheets, and I like to lock/protect
all
the sheets. Is it possible to do this in a simple way instead of that I
have
to lock each of them.
--
Jane




Jane

How do I lock several sheets
 
You're right: It can be fun - especially when it works!!
--
Jane


"Bernard Liengme" skrev:

This pair of subroutines with protect/Unprotect all the worksheets in the
current book. Unfamiliar with VBA? It really can be fun. See David
McRitchie's site on "getting started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Jane" wrote in message
...
I have a spredsheet with 100 identical sheets, and I like to lock/protect
all
the sheets. Is it possible to do this in a simple way instead of that I
have
to lock each of them.
--
Jane





Jane

How do I lock several sheets
 
An additional question: How do I make sure, that the protection can't be
removed by the user og my spredsheet? I would like to incorporate a code in
my protection.
--
Jane


"Bernard Liengme" skrev:

This pair of subroutines with protect/Unprotect all the worksheets in the
current book. Unfamiliar with VBA? It really can be fun. See David
McRitchie's site on "getting started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Jane" wrote in message
...
I have a spredsheet with 100 identical sheets, and I like to lock/protect
all
the sheets. Is it possible to do this in a simple way instead of that I
have
to lock each of them.
--
Jane





Dave Peterson

How do I lock several sheets
 
That's the bad news with excel. Worksheet protection is pretty easily broken.
If the user is dedicated, they'll find these newsgroups and get an answer in
moments.

But you can make it a little tougher by protecting your code:

Open your workbook
Open the VBE (alt-f11)
select your poject
Tools|VBAProject Properties|Protection tab
Give it a memorable password.

Save your workbook, close it and reopen it to test that protection.

Be aware that this password can be broken or avoided, too. So it's not
foolproof.

Jane wrote:

An additional question: How do I make sure, that the protection can't be
removed by the user og my spredsheet? I would like to incorporate a code in
my protection.
--
Jane

"Bernard Liengme" skrev:

This pair of subroutines with protect/Unprotect all the worksheets in the
current book. Unfamiliar with VBA? It really can be fun. See David
McRitchie's site on "getting started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Sub LockDown()
For Each ws In Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Sub UnlockAll()
For Each ws In Worksheets
ws.Unprotect
Next
End Sub

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Jane" wrote in message
...
I have a spredsheet with 100 identical sheets, and I like to lock/protect
all
the sheets. Is it possible to do this in a simple way instead of that I
have
to lock each of them.
--
Jane





--

Dave Peterson


All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com