Filehost.ro - gazduire fisiere
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.
Nou pe simpatie:
CriStiNutZa..
Femeie
24 ani
Bucuresti
cauta Barbat
26 - 80 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[EXCEL] Add/Remove Password to All Sheets [VBA]

Pagini: 1 Moderat de TRaP, TonyTzu
#1
Mrrrr
AdMiN
Postari: 2388
ADD PASSWORD TO ALL SHEETS IN A WORKBOOK


Sub Add_Password_to_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


REMOVE PASSWORD FROM ALL SHEETS IN A WORKBOOK - YOU KNOW THE PASSWORD


Sub Remove_Password_from_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


_______________________________________


 
   
Pagini: 1  
Mergi la