Results 1 to 6 of 6

Protect unprotect sheets with password and sort

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-10-2006
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2019, Win 10
    Posts
    102

    Protect unprotect sheets with password and sort

    I have the following code (provided here some years ago) which works fine. But I now need to modify it to include an optional password and to allow sort of unprotected cells on manually chosen sheets. Is this possible?

    Sub ProtectAllSHeets()
    
        Dim Sh As Worksheet
    
        For Each Sh In ActiveWorkbook.Worksheets
            Sh.Protect
        Next Sh
        
    End Sub
    
    Sub UnProtectAllSHeets()
    
        Dim Sh As Worksheet
    
        For Each Sh In ActiveWorkbook.Worksheets
            Sh.Unprotect
        Next Sh
        
    End Sub
    TIA

    Alan B
    Last edited by Zagra147; 05-13-2014 at 01:29 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA to Unprotect (w/ password), Unhide, Hide, and Protect (w/ password)
    By pger34 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-14-2012, 12:35 PM
  2. [SOLVED] Password protect and unprotect all sheets EXCEPT two named sheets
    By Ducatisto in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2012, 05:43 AM
  3. FIXED - MAcro to protect/unprotect sheets based on password in cell
    By pmcook1979 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-10-2012, 04:28 AM
  4. Macros to protect and unprotect sheets (Without a password)
    By David_S_Walker in forum Excel General
    Replies: 6
    Last Post: 03-30-2010, 06:44 AM
  5. Re: Password - Protect, UnProtect
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2005, 04:06 PM

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