Excel Support Logo Resize

Address

Suite 26, 135 Cardigan St, Carlton VIC 3053

Phone

03 9471 9057
excel support

Request A Quote

The following will help you Protect an entire workbook in one go using VBA. It is best if you know how to use or run VBA code to use this. If you don’t know how to use VBA code feel free to contact us.

Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window. Or alternatively choose it from the Ribbon in the Developer option.

Click Insert > Module, and paste the following code in the Module Window.

  Sub protect_all_sheets() On Error GoTo Excelsupport pass = InputBox("Please enter the password:") For Each Worksheet In ActiveWorkbook.Worksheets Worksheet.Protect Password:=pass Next Exit Sub  Excelsupport: MsgBox "There is an error with what you have entered - check password spelling or capslock."End Sub  

Then press F5 key to run the code, and enter the password that you want to apply for the sheets or alternatively insert a button or shape and assign the macro to it by right clicking on the button and selecting Assign Macro and then choosing the above.

Below is a short video on how to do this.