VBA Code to Protect Workbook with Password in Excel

This code protects the entire workbook with a password, preventing users from making any changes.

VBA Code:

Sub ProtectWorkbook()
    Dim password As String
    
    password = InputBox("Enter the password:")
    ThisWorkbook.Protect Password:=password
End Sub

Check All VBA Codes

Join Our Telegram Group techguruplus telegram group Join Our WhatsApp Group techguruplus whatsapp group

Leave a Comment