+ Reply to Thread
Results 1 to 3 of 3

Protecting Worksheets

  1. #1
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    200

    Protecting Worksheets

    If you have multiple worksheets in a workbook is there a way of protecting all sheets in one go or do you have to protect all individually?

  2. #2
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Hi

    Not as far as i know, but if you have macros enabled you can use two macros:

    Sub Macro1()
    Sheets("Sheet1").Select
    ActiveSheet.Protect "Music"
    Sheets("Sheet2").Select
    ActiveSheet.Protect "Music"
    Sheets("Sheet3").Select
    ActiveSheet.Protect "Music"
    Sheets("Sheet1").Select
    End Sub

    Sub macro2()
    Sheets("Sheet1").Select
    ActiveSheet.Unprotect "Music"
    Sheets("Sheet2").Select
    ActiveSheet.Unprotect "Music"
    Sheets("Sheet3").Select
    ActiveSheet.Unprotect "Music"
    Sheets("Sheet1").Select
    End Sub

    Hope it helps
    JR
    Versions
    Mac OS X 'Leopard'
    Mac MS Office Excel 2004
    Windows XP
    MS Excel 2002
    MS Excel 2003

  3. #3
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    more simplfied and more generic use the following

    Sub wsprotect()
    For Each ws In Worksheets
    ws.Protect "test"
    Next
    End Sub

    Sub wsunprotect()
    For Each ws In Worksheets
    ws.Unprotect "test"
    Next
    End Sub


    replace the part "test" with whatever password you want. this will protect and unprotect each sheet in the workbook no matter what their name is.

+ 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