View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default Require Password to overide data validation

use the sheet's change event ... I added another sheet, named it
'passwords' and made it xlVeryHidden. I put a password in A1

in you sheet with cell A6 to be checked, leave the datavalidation to handle
the amount. go to the sheet's code page (right-click the tab and choose View
Code) and paste in this:


Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A6").Address Then
If Not PasswordOK Then
Application.EnableEvents = False
Target = Range("A1")
Application.EnableEvents = True
End If
End If
End SubFunction PasswordOK() As Boolean
Dim pwd As String
pwd = InputBox("Please enter your password")
If pwd = Worksheets("passwords").Range("A1").Value Then
PasswordOK = True
End If
End Function

just one idea. another would be to check the username from the pc

"Jim" wrote in message
...
I would like to require a password for a user to overide data validation
in a
cell.

For example

Cell A5 shows a maximum loan value of $40,000. The user is to enter the
actual loan amount in A6, which I have a data validation of not to exceed
A5.
I would like to have the data validation reject any value of A5 unless the
user can enter a password.

Is this possible?