Protect sheets before close

G

Guest

How do I protect (no password needed) specific sheets - say sheet 1; 3 & 6
when a spreadsheet is closed?
Ideally I would like to use sheet reference rather than name
 
G

Guest

What you are looking for is the workbook level events stored in thisworkbook
(right click on the XL icon next to the word file in the menu bar and select
View Code). Add code something like this assuming that you have not changed
the code names of the sheets...

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheet1.Protect
Sheet3.Protect
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top