Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Profil angela31
Femeie
24 ani
Buzau
cauta Barbat
24 - 60 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Protect / unprotect all sheets at once Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TonyTzu
Moderator

Inregistrat: acum 12 ani
Postari: 252
The below mentioned code will protect all the worksheets in one go (only unlocked cells will remain editable):


Sub Protect_sheets()

    Dim wSheet          As Worksheet
    Dim Pwd             As String

    Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
    For Each wSheet In Worksheets
        wSheet.Protect Password:=Pwd
    Next wSheet

End Sub


The below mentioned code will Unprotect all worksheets in one go:


Sub Unprotect_sheets()

    Dim wSheet          As Worksheet
    Dim Pwd             As String

    Pwd = InputBox("Enter your password to unprotect all worksheets", "Password Input")
    On Error Resume Next
    For Each wSheet In Worksheets
        wSheet.Unprotect Password:=Pwd
    Next wSheet
    If Err <> 0 Then
        MsgBox "You have entered an incorect password. All worksheets could not " & _
        "be unprotected.", vbCritical, "Incorect Password"
    End If
    On Error GoTo 0

End Sub


pus acum 6 ani
   
Pagini: 1  

Mergi la