Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

macros

ResolvedVersion 365

Susie has attended:
Excel Advanced course

Macros

a macro to protect a workbook page by page please?

RE: macros

Hi Susie,

Thank you for the forum question.

The macro below will protect all sheets in the workbook the code is executed in with the password myPassword. If you want another password change the password in the code.



Sub ProtectSheetsWithPassword()

'Protect worksheet with a password

For i=1 to Sheets.count
Sheets(i).Protect Password:="myPassword"
Next i

End Sub



The link below is to a website, where you can find a lot of vba protection options

https://exceloffthegrid.com/vba-code-worksheet-protection/

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Thu 12 May 2022: Automatically marked as resolved.

Excel tip:

Shortcut for accessing recently opened files

To get into recently opened Excel files without using your mouse, hold down Alt + F to open the File menu.

Recently opened files are listed down the bottom of the File menu - type in the number next to the file you wish to open and it should appear on your screen.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.