locking use of the file.

  • Thread starter Thread starter FX Boudreaux
  • Start date Start date
F

FX Boudreaux

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.
 
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.
 
I need to run a Macro from a cell value if the cell value is greater
then 42. If the number is 43 and above, I need to lock close the sheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top