#1   Report Post  
carter
 
Posts: n/a
Default Password Protection

Is there a way to select and password protect multiple sheets in an excel
workbook, or must you do them one by one?
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

If you're doing it manually, you have to do it one by one.

But you could have a little macro do it for you.

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim myPwd As String
Dim mySelectedSheets As Object
Dim myActiveSheet As Worksheet

Set mySelectedSheets = ActiveWindow.SelectedSheets
Set myActiveSheet = ActiveSheet

mySelectedSheets(1).Select True

myPwd = "hi there"

For Each wks In mySelectedSheets
With wks
If .ProtectContents _
Or .ProtectDrawingObjects _
Or .ProtectScenarios Then
'already protected!
'wanna unprotect them?
'.Unprotect Password:=myPwd
Else
.Protect Password:=myPwd
End If
End With
Next wks

mySelectedSheets.Select
myActiveSheet.Activate

End Sub

Just group your sheets you want protected first.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

carter wrote:

Is there a way to select and password protect multiple sheets in an excel
workbook, or must you do them one by one?


--

Dave Peterson
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
Password Protection - Excel B R Nathan Excel Discussion (Misc queries) 1 February 10th 05 05:36 PM
Excel on XP: Password Protection Rich Hayes Excel Discussion (Misc queries) 1 February 4th 05 10:47 PM
How to define separate Password Protection, to say 3 persons, for. Sreeraman Thillaisthanam Seshadri Excel Worksheet Functions 1 December 17th 04 09:15 AM
How to define separate Password Protection, to say 3 persons, for. Sreeraman Thillaisthanam Seshadri Excel Worksheet Functions 2 December 17th 04 07:49 AM
Password protection andy Excel Discussion (Misc queries) 1 December 7th 04 02:51 PM


All times are GMT +1. The time now is 11:48 PM.

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"