View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
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?