Hi,
I have a worksheet, where I have setup password for each and individual tabs. when an employee wants to makechanges to his tab he needs to enter the password, so I have created password for each tabs. I have pasted the code below as to how it works.
Private Sub Worksheet_Activate()
Dim strPassword As String, _
entPassword As String, _
attempts As Long
attempts = 3
strPassword = "NICO1"
Do
entPassword = InputBox("Please enter the password")
If strPassword = entPassword And InStr(strPassword, entPassword) <> 0 Then
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.Unprotect
Else
attempts = attempts - 1
MsgBox "Incorrect password, please try again." & vbLf & attempts & " attempts remaining."
End If
Loop Until (entPassword = strPassword And InStr(strPassword, entPassword) <> 0) Or attempts = 0
If attempts = 0 Then
MsgBox "Please contact Vikas Quadros for your password"
Sheets(1).Activate 'Adjust this line to be a "safe" sheet in your workbook
End If
End Sub
Help that I need is.
I would like to enter in all the tabs and make few changes on a daily basis, it is difficult for me to remember and enter each and everyones password.
the help i require is I want a code where when the password prompt comes up I need to enter a master password, which will disable all the password in this worksheet, if the master password is not correct then the code executes as above.
From the above code if someone can add an IF code, then I guess it will work.
can you please help me
I have a worksheet, where I have setup password for each and individual tabs. when an employee wants to makechanges to his tab he needs to enter the password, so I have created password for each tabs. I have pasted the code below as to how it works.
Private Sub Worksheet_Activate()
Dim strPassword As String, _
entPassword As String, _
attempts As Long
attempts = 3
strPassword = "NICO1"
Do
entPassword = InputBox("Please enter the password")
If strPassword = entPassword And InStr(strPassword, entPassword) <> 0 Then
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.Unprotect
Else
attempts = attempts - 1
MsgBox "Incorrect password, please try again." & vbLf & attempts & " attempts remaining."
End If
Loop Until (entPassword = strPassword And InStr(strPassword, entPassword) <> 0) Or attempts = 0
If attempts = 0 Then
MsgBox "Please contact Vikas Quadros for your password"
Sheets(1).Activate 'Adjust this line to be a "safe" sheet in your workbook
End If
End Sub
Help that I need is.
I would like to enter in all the tabs and make few changes on a daily basis, it is difficult for me to remember and enter each and everyones password.
the help i require is I want a code where when the password prompt comes up I need to enter a master password, which will disable all the password in this worksheet, if the master password is not correct then the code executes as above.
From the above code if someone can add an IF code, then I guess it will work.
can you please help me