Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Disable Select Cells Q

I have the following code, which I though would stop the ability of the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Disable Select Cells Q

Sean,
You code works for me.
But ActiveSheet.EnableSelection is not a persistent property; you have to
set it every time the file is opened, may in the Workbook_Open() event.

NickHK

"Sean" wrote in message
ups.com...
I have the following code, which I though would stop the ability of the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Disable Select Cells Q

Thanks Guys, your option worked Mike


Mike wrote:
try

Sheets("E-Mail").Activate
ActiveSheet.protect
ActiveSheet.EnableSelection = xlUnlockedCells

Mike
"Sean" wrote:

I have the following code, which I though would stop the ability of the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Disable Select Cells Q

There's no need to Select or Activate the sheet (or anything else, for that
matter), and doing so may have unintended consequences (e.g., the rest of
the procedure may rely on a particular sheet being active).

Instead, use code like

With Sheets("E-Mail")
.Protect
.EnableSelection = xlUnlockedCells
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Mike" wrote in message
...
try

Sheets("E-Mail").Activate
ActiveSheet.protect
ActiveSheet.EnableSelection = xlUnlockedCells

Mike
"Sean" wrote:

I have the following code, which I though would stop the ability of the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Disable Select Cells Q

The code worked yesterday, using Office 2003, but now today with
another user using Office 2000 it hasn't. Is the code not supported in
Office 2000?



Chip Pearson wrote:
There's no need to Select or Activate the sheet (or anything else, for that
matter), and doing so may have unintended consequences (e.g., the rest of
the procedure may rely on a particular sheet being active).

Instead, use code like

With Sheets("E-Mail")
.Protect
.EnableSelection = xlUnlockedCells
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Mike" wrote in message
...
try

Sheets("E-Mail").Activate
ActiveSheet.protect
ActiveSheet.EnableSelection = xlUnlockedCells

Mike
"Sean" wrote:

I have the following code, which I though would stop the ability of the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Disable Select Cells Q

It should work in all versions since at least 97, as far as I know.
Specifically what do you mean by "doesn't work"? Details count.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Sean" wrote in message
ups.com...
The code worked yesterday, using Office 2003, but now today with
another user using Office 2000 it hasn't. Is the code not supported in
Office 2000?



Chip Pearson wrote:
There's no need to Select or Activate the sheet (or anything else, for
that
matter), and doing so may have unintended consequences (e.g., the rest of
the procedure may rely on a particular sheet being active).

Instead, use code like

With Sheets("E-Mail")
.Protect
.EnableSelection = xlUnlockedCells
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Mike" wrote in message
...
try

Sheets("E-Mail").Activate
ActiveSheet.protect
ActiveSheet.EnableSelection = xlUnlockedCells

Mike
"Sean" wrote:

I have the following code, which I though would stop the ability of
the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Disable Select Cells Q

Chip, if I run the code on my PC (Excel 2003) I can't select cells in
the relevant sheet, but another person runs it from their PC (Excel
2000) and you can select cells.

I also notice that on one sheet of this workbook the .DisplayGridlines
= False is not activated (but it is when I run it - part of the same
code)

I've even recorded a macro (on the 2000 PC) to remove the
ActiveSheet.EnableSelection = xlUnlockedCells and it works, yet when
the particular code I'm running is run, no such luck

Must sheets be visible when .EnableSelection = xlUnlockedCells is run?




Chip Pearson wrote:
It should work in all versions since at least 97, as far as I know.
Specifically what do you mean by "doesn't work"? Details count.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Sean" wrote in message
ups.com...
The code worked yesterday, using Office 2003, but now today with
another user using Office 2000 it hasn't. Is the code not supported in
Office 2000?



Chip Pearson wrote:
There's no need to Select or Activate the sheet (or anything else, for
that
matter), and doing so may have unintended consequences (e.g., the rest of
the procedure may rely on a particular sheet being active).

Instead, use code like

With Sheets("E-Mail")
.Protect
.EnableSelection = xlUnlockedCells
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Mike" wrote in message
...
try

Sheets("E-Mail").Activate
ActiveSheet.protect
ActiveSheet.EnableSelection = xlUnlockedCells

Mike
"Sean" wrote:

I have the following code, which I though would stop the ability of
the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Disable Select Cells Q

I again tested this same code this AM and it works when running on 2003
but not on 2000


Sean wrote:

Chip, if I run the code on my PC (Excel 2003) I can't select cells in
the relevant sheet, but another person runs it from their PC (Excel
2000) and you can select cells.

I also notice that on one sheet of this workbook the .DisplayGridlines
= False is not activated (but it is when I run it - part of the same
code)

I've even recorded a macro (on the 2000 PC) to remove the
ActiveSheet.EnableSelection = xlUnlockedCells and it works, yet when
the particular code I'm running is run, no such luck

Must sheets be visible when .EnableSelection = xlUnlockedCells is run?




Chip Pearson wrote:
It should work in all versions since at least 97, as far as I know.
Specifically what do you mean by "doesn't work"? Details count.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Sean" wrote in message
ups.com...
The code worked yesterday, using Office 2003, but now today with
another user using Office 2000 it hasn't. Is the code not supported in
Office 2000?



Chip Pearson wrote:
There's no need to Select or Activate the sheet (or anything else, for
that
matter), and doing so may have unintended consequences (e.g., the rest of
the procedure may rely on a particular sheet being active).

Instead, use code like

With Sheets("E-Mail")
.Protect
.EnableSelection = xlUnlockedCells
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Mike" wrote in message
...
try

Sheets("E-Mail").Activate
ActiveSheet.protect
ActiveSheet.EnableSelection = xlUnlockedCells

Mike
"Sean" wrote:

I have the following code, which I though would stop the ability of
the
user to select locked cells, but it doesn't. It protects my sheet, but
user can still select cells. Do I have something wrong?


Sheets("E-Mail").Activate
ActiveSheet.EnableSelection = xlNoSelection
ActiveSheet.Protect Password:="1234"




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
Up down arrow keys do not select cells if select locked cells unch roandrob Excel Discussion (Misc queries) 3 May 18th 09 12:48 AM
Excel 2007 Pivot Tables - Page Field Row Height; Disable Select MultItems delecto Excel Discussion (Misc queries) 0 October 31st 08 09:28 PM
how do you "select locked cells" w/o "select unlocked cells"? princejohnpaulfin Excel Discussion (Misc queries) 3 July 16th 05 03:53 AM
Code to select 'Disable Macro' when opening an EXTERNAL FILE G rumpy O ld D uffer Excel Programming 1 March 22nd 05 05:32 PM
disable mulitple select on pivot page field belinda Excel Programming 0 July 12th 04 02:22 PM


All times are GMT +1. The time now is 11:44 AM.

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"