Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default protecting multiple sheets

I would like to protect / deprotect multiple sheets with a single password in
a single action

At present i have to protect each sheet individually, each with the same
password which is tedious, especially as i have to do each sheet each time i
protect or deprotect it.

My 10 sheets are named : St1, St2, St3.........up to St10

Ideally i would like a form to pop up when i push a button which allows me
to either protect or deprotect these 10 sheets with my password in a single
action.

Can anyone help?

Regards,

Roger
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default protecting multiple sheets

Protect all sheets...............

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

Unprotect all sheets....................

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

Protect selected sheets..........................

Sub Protect_Selected_Sheets()
Application.ScreenUpdating = False
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.Protect Password:="justme"
Next ws
Application.ScreenUpdating = True
End Sub

Unprotect selected sheets................

Sub UnProtect_Selected_Sheets()
Application.ScreenUpdating = False
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.UnProtect Password:="justme"
Next ws
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Sun, 3 Aug 2008 17:35:02 -0700, Roger on Excel
wrote:

I would like to protect / deprotect multiple sheets with a single password in
a single action

At present i have to protect each sheet individually, each with the same
password which is tedious, especially as i have to do each sheet each time i
protect or deprotect it.

My 10 sheets are named : St1, St2, St3.........up to St10

Ideally i would like a form to pop up when i push a button which allows me
to either protect or deprotect these 10 sheets with my password in a single
action.

Can anyone help?

Regards,

Roger


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default protecting multiple sheets

Thanks Gord,

Your kind help, together with posts from others has given me the code I need
to make this work nicely.

Best regards,

Roger

"Gord Dibben" wrote:

Protect all sheets...............

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

Unprotect all sheets....................

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

Protect selected sheets..........................

Sub Protect_Selected_Sheets()
Application.ScreenUpdating = False
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.Protect Password:="justme"
Next ws
Application.ScreenUpdating = True
End Sub

Unprotect selected sheets................

Sub UnProtect_Selected_Sheets()
Application.ScreenUpdating = False
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.UnProtect Password:="justme"
Next ws
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Sun, 3 Aug 2008 17:35:02 -0700, Roger on Excel
wrote:

I would like to protect / deprotect multiple sheets with a single password in
a single action

At present i have to protect each sheet individually, each with the same
password which is tedious, especially as i have to do each sheet each time i
protect or deprotect it.

My 10 sheets are named : St1, St2, St3.........up to St10

Ideally i would like a form to pop up when i push a button which allows me
to either protect or deprotect these 10 sheets with my password in a single
action.

Can anyone help?

Regards,

Roger



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
Protecting Multiple Sheets SUSAN Excel Discussion (Misc queries) 3 August 8th 07 08:39 PM
Protecting Multiple Sheets pjd Excel Discussion (Misc queries) 1 April 4th 05 05:02 PM
Protecting multiple sheets mik00725 Excel Discussion (Misc queries) 1 February 17th 05 02:36 AM
Protecting and Unprotecting multiple sheets pkley Excel Programming 3 January 22nd 04 05:26 PM
Protecting Multiple sheets with prompt for password to unprotect pkley Excel Programming 1 January 10th 04 06:46 AM


All times are GMT +1. The time now is 06:03 PM.

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

About Us

"It's about Microsoft Excel"