View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tiptoe tiptoe is offline
external usenet poster
 
Posts: 15
Default Data Entry and Protection

On Feb 20, 3:10 am, Ken Johnson wrote:
Maybe something like this...

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Sheet1.Unprotect "tiptoe"
Dim rgCell As Range
For Each rgCell In Range("B2:C11")
If rgCell.Value = "" Then
rgCell.Locked = False
Else: rgCell.Locked = True
End If
Next
Sheet1.Protect "tiptoe"
End Sub

When the workbook is saved each cell in the range of cells where data
is to be entered by all the different other users (Sheet1!B2:C11 in
the sample code) is locked if not blank and unlocked if blank. The
sheet is protected with the password "tiptoe"

The code has to be pasted into the ThisWorkbook code module.

Ken Johnson


Ken,
Thanks, looking good.

Regards,
tiptoe