Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Protect sheets before close

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Protect sheets before close

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
--
HTH...

Jim Thomlinson


"Saintsman" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Protect sheets before close

Thanks very much for quick response & helpful answer

"Jim Thomlinson" wrote:

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
--
HTH...

Jim Thomlinson


"Saintsman" wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect cells with data on save/close AJPendragon Excel Worksheet Functions 0 November 18th 08 10:27 PM
how to setup a excel sheet to be protect after save and close file Marco Excel Discussion (Misc queries) 0 March 11th 08 10:56 PM
Can I protect a document and still open / close groups Paul Excel Worksheet Functions 1 September 25th 06 06:47 PM
Protect macro and close VBE programatically biosci[_5_] Excel Programming 2 April 8th 06 11:50 AM
how to protect sheets from VBA? jon Excel Programming 1 September 16th 04 06:11 PM


All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"