ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Psswd protect a sheet automatically upon closing file (https://www.excelbanter.com/excel-programming/330692-re-psswd-protect-sheet-automatically-upon-closing-file.html)

Linking to specific cells in pivot table

Psswd protect a sheet automatically upon closing file
 
Thanks so much Dominic!!! That is perfect.

"dominicb" wrote:


Good morning Robert

You need this macro to be put into the ThisWorkbook section of your
file:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Protect password:="devide", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

If the thought of that gives you a cold sweat, here's what you do.
From XL press alt + F11, this will open the Visual Basic Editor and
find your file in the project window - top left. Look for the
ThisWorkbook section and double click on it, and copy the macro above
into the blank pane. Close the VBE and save your file. Job done.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=375555



dominicb[_12_]

Psswd protect a sheet automatically upon closing file
 

Hi Robert

You're welcome, and I appreciate the feedback.

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=37555



All times are GMT +1. The time now is 07:22 PM.

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