+ Reply to Thread
Results 1 to 3 of 3

Password Protection

  1. #1
    carter
    Guest

    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. #2
    Registered User
    Join Date
    09-17-2003
    Posts
    18
    I was just looking at that problem; I have not found a way to set password protection to individual sheets within a workbook in a batch process. As far as I know, you have to go into individual one.

  3. #3
    Dave Peterson
    Guest

    Re: Password Protection

    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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1