Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default need code for disable selection of locked cells

Got code
Sub protect()

Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
ws.EnableSelection = xlUnlockedCells
ws.protect Password:=""
Next ws

End Sub

I need to disable selection of locked cells
Is there a function like ws.DisableSelection = xlLockedCells?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default need code for disable selection of locked cells

Hi David,

I need to disable selection of locked cells
Is there a function like ws.DisableSelection = xlLockedCells?


That is what your code does.

If, as in your code, you set the EnableSelection to unlocked cells, only
unlocked cells can be selected - locked cells become unselectable.

---
Regards,
Norman



"David Lewis" wrote in message
...
Got code
Sub protect()

Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
ws.EnableSelection = xlUnlockedCells
ws.protect Password:=""
Next ws

End Sub

I need to disable selection of locked cells
Is there a function like ws.DisableSelection = xlLockedCells?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default need code for disable selection of locked cells

hi David

This will only allow unlocked cells to be selected as long as the sheets are
protected. You code does not unprotect the sheets first (although you could
get around this by setting the userinterface to true).

Sub test()
Dim ws As Worksheet
For Each ws In Worksheets
With ws
..Unprotect
..EnableSelection = xlUnlockedCells
..Protect
End With
Next ws
End Sub

--
XL2002
Regards

William



"David Lewis" wrote in message
...
| Got code
| Sub protect()
|
| Dim ws As Worksheet
|
| For Each ws In ActiveWorkbook.Worksheets
| ws.EnableSelection = xlUnlockedCells
| ws.protect Password:=""
| Next ws
|
| End Sub
|
| I need to disable selection of locked cells
| Is there a function like ws.DisableSelection = xlLockedCells?
|


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default need code for disable selection of locked cells

You can modify the Scroll Area to restrict which cells can be selected... It
requires a single continuious range of cells though. The user can only move
within that range of cells. Otherwise there is nothing that I know of to keep
the user from selecting a cell. Locking it only protects it from being
updated. You can hide the formula of a locked cell if that helps...

HTH

"David Lewis" wrote:

Got code
Sub protect()

Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
ws.EnableSelection = xlUnlockedCells
ws.protect Password:=""
Next ws

End Sub

I need to disable selection of locked cells
Is there a function like ws.DisableSelection = xlLockedCells?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default need code for disable selection of locked cells

All I know is my code locks the page. When I save and close and go back I can select the cells again.
If I manually lock the cells and uncheck the locked cells option then it works properly.

"Norman Jones"
|Hi David,
|
| I need to disable selection of locked cells
| Is there a function like ws.DisableSelection = xlLockedCells?
|
|That is what your code does.
|
|If, as in your code, you set the EnableSelection to unlocked cells, only
|unlocked cells can be selected - locked cells become unselectable.
|
|---
|Regards,
|Norman
|
|
|
|"David Lewis" wrote in message
. ..
| Got code
| Sub protect()
|
| Dim ws As Worksheet
|
| For Each ws In ActiveWorkbook.Worksheets
| ws.EnableSelection = xlUnlockedCells
| ws.protect Password:=""
| Next ws
|
| End Sub
|
| I need to disable selection of locked cells
| Is there a function like ws.DisableSelection = xlLockedCells?
|
|

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
Locked worksheet & hyperlinks (w/ select locked cells unchecked) dgold82 Excel Discussion (Misc queries) 1 July 10th 09 09:42 PM
cell selection appears to be locked Heinz Excel Discussion (Misc queries) 2 August 31st 06 01:44 AM
cell selection appears locked. How do I unlock it. Heinz Excel Worksheet Functions 1 August 30th 06 08:24 PM
Put comments on a locked spreadsheet even though cells not locked RDP Excel Worksheet Functions 1 September 11th 05 11:59 PM
Help : Code for selection non-contiguous cells Majeed Excel Programming 1 November 24th 03 06:49 PM


All times are GMT +1. The time now is 01:21 AM.

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"