Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Locked worksheet & hyperlinks (w/ select locked cells unchecked) | Excel Discussion (Misc queries) | |||
cell selection appears to be locked | Excel Discussion (Misc queries) | |||
cell selection appears locked. How do I unlock it. | Excel Worksheet Functions | |||
Put comments on a locked spreadsheet even though cells not locked | Excel Worksheet Functions | |||
Help : Code for selection non-contiguous cells | Excel Programming |