Hi all,
I've done the following code to password protect a sheet in Excel to make it non viewable unless the correct password is entered.
However, when the pop up box asks for the passworld to be entered, you can see what is being typed. What do I need to add to make it ************* instead? (appear as asterixs?) Thanks
I've done the following code to password protect a sheet in Excel to make it non viewable unless the correct password is entered.
However, when the pop up box asks for the passworld to be entered, you can see what is being typed. What do I need to add to make it ************* instead? (appear as asterixs?) Thanks
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim strPass As String
Dim lCount As Long
If Sh.CodeName <> "Sheet8" Then
'Set sLast variable to the last active sheet _
This is then used to return the user to the _
last sheet they were on if password is not known _
or they Cancel.
Set sLast = Sh
Else
'Hide Columns
Sheet8.Columns.Hidden = True
'Allow 3 attempts at password
For lCount = 1 To 3
strPass = InputBox(Prompt:="Password Please", Title:="PASSWORD REQUIRED")
If strPass = vbNullString Then 'Cancelled
sLast.Select
Exit Sub
ElseIf strPass <> "" Then 'InCorrect password
MsgBox "Password incorrect"
Else 'Correct Password
Exit For
End If
Next lCount
If lCount = 4 Then 'They use up their 3 attempts
sLast.Select
Exit Sub
Else 'Allow viewing
Sheet1.Columns.Hidden = False
End If
End If
End Sub