password protection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to password protect an individual cell (rather than the whole sheet) so that some cells appear blank and if selected they prompt for a password for viewing?
Thankyou for any help.
 
Hi Matt
this is not possible with the build-in functionality in Excel. I could
imagine trying the following to achieve something similar
- format the cell with a white font color
- use the selection_change event of this worksheet:
-> if this specific cell is selected ask for a password
-> format the cell with a black font color if the pwd is correct
-> in all other cases (other cells are selected) change the font
color to white

Note: a determined user will simply change the font color of the whole
column -> no chance to prevent this if the worksheet is not protected.
So in your case I would protect the entire worksheet but lock only
these specific cells. You may add to this the selection change event
and unlock the worksheet (and therefore show the cell contents) if the
user enters this cell
 
Perhaps store the cell values in an xlVeryHidden worksheet
and import them if the password is correct:

Const Pwd As String = "horse"
Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
Dim Resp As Variant, myRange As Range
Set myRange = Range("A1:A10")
If Not Intersect(Target, myRange) Is Nothing Then
If Target.Count = 1 Then
Do Until Resp = Pwd
Resp = InputBox("Enter password to view cell
contents . . .", "Password Entry")
If Resp = "" Then Exit Sub
If Resp = Pwd Then
Target = Sheets("Hidden").Range
(Target.Address)
Else
MsgBox "Password failed !!! ",
vbExclamation, "Password entry"
End If
Loop
End If
End If
End Sub

Regards,
Greg
-----Original Message-----
Is it possible to password protect an individual cell
(rather than the whole sheet) so that some cells appear
blank and if selected they prompt for a password for
viewing?
 
Back
Top