I have some code which has always ran perfectly but have recently started getting this error. Has anyone any ideas what is going wrong? The error is highlighted at the Password = Inputbox row.
I have two files with this code in and one works and one doesnt so im presuming I have messed up something in the back end?
Sub UnhideAllSheets()
Dim ws As Worksheet
Dim sht As Object
Dim myPassword As String
myPassword = "Resting4444" ' Set password here
Password = InputBox("Enter Password")
Application.ScreenUpdating = False
If Password = "" Then Exit Sub ' Exit if null input or cancel
' Incorrect password
If Password <> myPassword Then
MsgBox Title:="Warning", Prompt:="Incorrect Password"
Exit Sub
End If
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Sheets("Data").Select
Application.ScreenUpdating = True
End Sub
I have two files with this code in and one works and one doesnt so im presuming I have messed up something in the back end?
Sub UnhideAllSheets()
Dim ws As Worksheet
Dim sht As Object
Dim myPassword As String
myPassword = "Resting4444" ' Set password here
Password = InputBox("Enter Password")
Application.ScreenUpdating = False
If Password = "" Then Exit Sub ' Exit if null input or cancel
' Incorrect password
If Password <> myPassword Then
MsgBox Title:="Warning", Prompt:="Incorrect Password"
Exit Sub
End If
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Sheets("Data").Select
Application.ScreenUpdating = True
End Sub