ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   need a macro to lock sheet (https://www.excelbanter.com/excel-programming/357160-need-macro-lock-sheet.html)

DGR

need a macro to lock sheet
 
I would like a simple macro that inserts my password into the 2 protection
fields when locking the sheet.
When I go to unprotect the sheets the file doesn't ask for the password?

Tom Ogilvy

need a macro to lock sheet
 
Activesheet.Protect Password:="ABC"

Activesheet.Unprotect Password:="ABC"

are the commands.

Just another thought.
You need to save the workbook before closing if you want them to be in
effect when you open it.

--
Regards,
Tom Ogilvy


"dgr" wrote:

I would like a simple macro that inserts my password into the 2 protection
fields when locking the sheet.
When I go to unprotect the sheets the file doesn't ask for the password?



All times are GMT +1. The time now is 03:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com