Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Protect worksheet - do not allow select cells

I want to protect a worksheet in a workbook that is not the one my code
is running from. I am able to do this with
Workbooks(FileName.xls).Sheets("Sheet1").Protect Password:="password"

The problem is that by default Excel allows the cells of a protected
sheet. to be selected. I do not want to allow this. When I protect the
sheet manually through Tools--Protection--Protect Sheet I can just
uncheck the boxes that say "select locked/unlocked cells" and its
protected the way I want. Is there a command I can use to have my macro
uncheck these options?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Protect worksheet - do not allow select cells

Jon

ActiveSheet.EnableSelection = xlNoSelection

If you record a macro while protecting the sheet and checking the appropriate
boxes, you will see the code used by Excel.


Gord Dibben Excel MVP

On 21 Nov 2005 11:56:46 -0800, "Jon" wrote:

I want to protect a worksheet in a workbook that is not the one my code
is running from. I am able to do this with
Workbooks(FileName.xls).Sheets("Sheet1").Protec t Password:="password"

The problem is that by default Excel allows the cells of a protected
sheet. to be selected. I do not want to allow this. When I protect the
sheet manually through Tools--Protection--Protect Sheet I can just
uncheck the boxes that say "select locked/unlocked cells" and its
protected the way I want. Is there a command I can use to have my macro
uncheck these options?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Protect worksheet - do not allow select cells

I tried that, it didnt seem to do anything. This may be because I save
and close the file I am protecting a the end of the macro. Does Excel
maybe forget that set the no selection option?

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
How do I protect selected cells on my worksheet? Abraz Setting up and Configuration of Excel 1 September 13th 06 06:27 PM
How do I protect selected cells on my worksheet? Abraz Setting up and Configuration of Excel 1 September 13th 06 12:28 PM
Can I Protect Just A Few Cells On A Worksheet? Joe Miller Excel Discussion (Misc queries) 3 August 14th 06 02:37 PM
Is there a way to protect individual cells in a worksheet? let me know Excel Worksheet Functions 1 October 3rd 05 05:40 PM
Protect from copying cells or worksheet Jim Rech Excel Programming 0 November 8th 04 09:36 PM


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

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

About Us

"It's about Microsoft Excel"