Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Sue
 
Posts: n/a
Default protecting multiple worksheets

Is there any way of protecting worksheets in an excel 2003 workbook all at
once instead of having to do each individual worksheet? I have 17 worksheets
in two workbooks so individually it takes alot of time to password them. Any
ideas.
  #2   Report Post  
Paul Sheppard
 
Posts: n/a
Default


Sue Wrote:
Is there any way of protecting worksheets in an excel 2003 workbook all
at
once instead of having to do each individual worksheet? I have 17
worksheets
in two workbooks so individually it takes alot of time to password
them. Any
ideas.


Hi Sue

The best way would be with a macro

Try this

Public Sub Protect_All()
Dim wks As Worksheet
Dim vPword As Variant
vPword = Application.InputBox( _
prompt:="Enter Password: ", _
Title:="Protect sheets", _
Default:="", _
Type:=2)
If vPword = False Then Exit Sub 'user cancelled
For Each wks In ActiveWorkbook.Worksheets
wks.Protect vPword
Next
End Sub

and to Unprotect try this

Public Sub Unprotect_All()
Dim wks As Worksheet
Dim vPword As Variant
On Error Resume Next
For Each wks In ActiveWorkbook.Worksheets
With wks
.Unprotect vPword
Do While .ProtectContents
vPword = Application.InputBox( _
prompt:="Enter password for " & .Name, _
Title:="Unprotect sheets", _
Default:="", _
Type:=2)
If vPword = False Then Exit Sub 'user cancelled
.Unprotect vPword
Loop
End With
Next
End Sub


--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=466737

  #3   Report Post  
Sue
 
Posts: n/a
Default

Hi Paul,
I haven't done a macro but funnily enough I have started reading how to do
them last night off the getting started site by d m c ritchie, so I will give
it a go.
Thanks heaps
Sue

"Paul Sheppard" wrote:


Sue Wrote:
Is there any way of protecting worksheets in an excel 2003 workbook all
at
once instead of having to do each individual worksheet? I have 17
worksheets
in two workbooks so individually it takes alot of time to password
them. Any
ideas.


Hi Sue

The best way would be with a macro

Try this

Public Sub Protect_All()
Dim wks As Worksheet
Dim vPword As Variant
vPword = Application.InputBox( _
prompt:="Enter Password: ", _
Title:="Protect sheets", _
Default:="", _
Type:=2)
If vPword = False Then Exit Sub 'user cancelled
For Each wks In ActiveWorkbook.Worksheets
wks.Protect vPword
Next
End Sub

and to Unprotect try this

Public Sub Unprotect_All()
Dim wks As Worksheet
Dim vPword As Variant
On Error Resume Next
For Each wks In ActiveWorkbook.Worksheets
With wks
.Unprotect vPword
Do While .ProtectContents
vPword = Application.InputBox( _
prompt:="Enter password for " & .Name, _
Title:="Unprotect sheets", _
Default:="", _
Type:=2)
If vPword = False Then Exit Sub 'user cancelled
.Unprotect vPword
Loop
End With
Next
End Sub


--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=466737


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
Functions across multiple worksheets starlight Excel Worksheet Functions 0 August 10th 05 05:10 PM
Sumif with multiple worksheets Cbh35711 Excel Worksheet Functions 3 August 9th 05 02:49 PM
Adding multiple worksheets Craig Excel Worksheet Functions 1 July 6th 05 07:21 PM
Sort rows across multiple worksheets - Excel 2003 Stamdale Excel Worksheet Functions 2 July 5th 05 04:30 PM
Countif with multiple criteria and multiple worksheets JJ Excel Worksheet Functions 1 December 28th 04 06:37 PM


All times are GMT +1. The time now is 04:13 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"