ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password in a single cell (https://www.excelbanter.com/excel-programming/335865-password-single-cell.html)

Angeliki

Password in a single cell
 
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



Tom Ogilvy

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






All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com