Hi, John,
thanks for the feedback.
A small alteration for the number of tries which might be of interest to you as well:
Sub ShowDataSheets()
Dim ws As Worksheet
Static lngTries As Long
Const cstrPW As String = "strangePW"
Const clngMAX As Long = 3
If InputBox(Prompt:="Enter the password", Title:="Enter password", Default:="enter password here") = cstrPW Then
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Else
lngTries = lngTries + 1
MsgBox "Sorry, wrong password", vbInformation, "Missed trie: " & lngTries & " of " & clngMAX & " tries"
If lngTries = clngMAX Then ThisWorkbook.Close True
End If
End Sub
Ciao,
Holger
Bookmarks