View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default locking use of the file.

One way:

Assuming the limit is 0 < A1 < 100:


Private Sub Worksheet_Calculate()
Const PWORD As String = "drowssap"
Dim bValid As Boolean
With Range("A1")
If IsNumeric(.Value) Then _
If .Value 0 Then _
If .Value < 100 Then _
bValid = True
End With
If Not bValid Then
Me.Unprotect PWORD
Me.Cells.Locked = True
Me.Protect PWORD
MsgBox "A1 is out of range. Call home."
End If
End Sub

This can be modified if more than one sheet needs to be locked down.

However, be aware that worksheet protection is extremely weak. A
motivated user with enough skill to find this newsgroup can figure out
how to bypass it.



In article ,
"FX Boudreaux" wrote:

I would like to lock to file if the value of cell is outside its limit
value. Then the person using the file would have to call in and get help.