View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Password in a single cell

Private Sub Worksheet_Change(ByVal Target As Range)
Dim pwd as String
If Target.Count 1 Then Exit Sub
On Error goto ErrHandler
If Target.Address = "$B$1" Then
if Target.Value <= Range("A1") * 0.80 then
pwd = InputBox "What is the password?"
if lcase(pwd) < "abcd" then
Application.EnableEvents = False
Target.ClearContents
msgbox "Must be Greater than " & .8 * Range("A1")
end if
End If
End If
ErrHandler:
Application.EnableEvents = True
End Sub

Right click on the sheet tab and select view code. Paste in code similar to
the above.

--
Regards,
Tom Ogilvy


"Angeliki" wrote in message
...
Hello all

I have 2 cells. In the first one I input the actual value and at the

second
one
i input the estimated one. However i want to have a password if the
estimated value is less
than 80% of the actual. If it is more than 80% then i would like to

proceed
as it is but if is less
i would like to have a password before i proceed.
Could you please help me with this one?

Thanks in advance
AngelikiS