I have the following code that's not working. It asks for the password and even provides the message if the incorrect password is entered. But it won't unhide the worksheets. The code is getting hung on ws.Visible = xlSheetVisible. What have I done incorrectly. Assistance is greatly appreciated.
Sub UnhideAllSheets()
Dim ws As Worksheet
Dim myPassword As String
myPassword = "password"
If InputBox("Please enter password: ") = myPassword Then
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Application.ScreenUpdating = True
Else
MsgBox ("Incorrect password, please see Teresa")
End If
End Sub
Sub UnhideAllSheets()
Dim ws As Worksheet
Dim myPassword As String
myPassword = "password"
If InputBox("Please enter password: ") = myPassword Then
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Application.ScreenUpdating = True
Else
MsgBox ("Incorrect password, please see Teresa")
End If
End Sub