Michael M
Well-known Member
- Joined
- Oct 27, 2005
- Messages
- 21,727
- Office Version
- 365
- 2019
- 2013
- 2007
- Platform
- Windows
Hi All
I have the following macros for closing and opening numerous worksheets.
However, the Unlock macro asks for a password even though I haven't locked the sheets with one.
When the input box comes up for the password, I press enter and get the END, DEBUG error window.
If I press END the error message goes away and all of the sheets are unprotected.
Can anyone explain how I can get rid of the error message and Input box.
Sheets are only protected so I don't screw up the formulae, so a password isn't really necessary.
Kindest regards
Michael M
Sub SheetLock()
'
' SheetLock Macro
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
ws.Protect
Next ws
Application.ScreenUpdating = True
End Sub
Sub SheetUnLock()
'
' SheetUnLock Macro
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
ws.Unprotect
Next ws
Application.ScreenUpdating = True
End Sub
I have the following macros for closing and opening numerous worksheets.
However, the Unlock macro asks for a password even though I haven't locked the sheets with one.
When the input box comes up for the password, I press enter and get the END, DEBUG error window.
If I press END the error message goes away and all of the sheets are unprotected.
Can anyone explain how I can get rid of the error message and Input box.
Sheets are only protected so I don't screw up the formulae, so a password isn't really necessary.
Kindest regards
Michael M
Sub SheetLock()
'
' SheetLock Macro
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
ws.Protect
Next ws
Application.ScreenUpdating = True
End Sub
Sub SheetUnLock()
'
' SheetUnLock Macro
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
ws.Unprotect
Next ws
Application.ScreenUpdating = True
End Sub