Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Protection Macro

Hello.

I'm looking for a macro to run to protect all worksheets in a workbook, I
have about 50 worksheets and its a lot of work going through the protection
menu for every worksheet, Can someone give me a macro to run so when run it
protects all worksheets in the workbook and also one to run to unprotect all
worksheets in a workbook.

many Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Protection Macro


Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub

Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Mon, 4 Feb 2008 14:02:00 -0800, santaviga
wrote:

Hello.

I'm looking for a macro to run to protect all worksheets in a workbook, I
have about 50 worksheets and its a lot of work going through the protection
menu for every worksheet, Can someone give me a macro to run so when run it
protects all worksheets in the workbook and also one to run to unprotect all
worksheets in a workbook.

many Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Protection Macro

Many thanks

"Gord Dibben" wrote:


Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub

Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Mon, 4 Feb 2008 14:02:00 -0800, santaviga
wrote:

Hello.

I'm looking for a macro to run to protect all worksheets in a workbook, I
have about 50 worksheets and its a lot of work going through the protection
menu for every worksheet, Can someone give me a macro to run so when run it
protects all worksheets in the workbook and also one to run to unprotect all
worksheets in a workbook.

many Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
macro for protection ynissel Excel Discussion (Misc queries) 3 August 3rd 05 09:52 PM
Macro protection Michelle Excel Programming 1 September 24th 04 01:56 PM
macro protection leigh Excel Programming 1 May 4th 04 06:21 PM
Protection + Macro = NOTHING! GOAT2G Excel Programming 0 May 4th 04 06:09 PM


All times are GMT +1. The time now is 09:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"