Require Password to overide data validation

J

Jim

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?
 
P

Patrick Molloy

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
 

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

Top