View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default Locked cell without alert

Below is code that I found in this ng.
It does even more that protect the sheets, it also prevents the
user from selecting protected cells.

Select UnProtected Cells ONLY
This will prevent users from clicking on protected cells on all
worksheets. Therefore, the warning message will not appear. The code
must be enterred in the ThisWorkbook module.

Note that the EnableSelection property must be reset each time the
workbook is opened as it defaults to xlNoRestrictions. The
worksheet(s)
must first be unprotected to set the EnableSelection property and then
must be protected for it to take effect.

Private Sub Workbook_Open()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
WS.Unprotect 'Password:="wxyz"
WS.EnableSelection = xlUnlockedCells
WS.Protect 'Password:="wxyz", UserInterfaceOnly:=True
Next
End Sub

Regards,
Greg Wilson 5/3/03


--
steveB

Remove "AYN" from email to respond
"milly" wrote in message
...
Hi all!
I have locked a range of cells by vba and I'd like that when the user
tries
to edit them, the alert messagebox with the edit-password textbox DOESN't
appear...
Is it possible?
thanks!