Krulle1000
New Member
- Joined
- Feb 25, 2016
- Messages
- 15
Hello,
How can I allow to hide sheets in my locked workbook? The code below doesn't work.
I receive Error 1004: Application-defined or object-defined error.
If I unlock my workbook than the code passes.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
For Each ws In ThisWorkbook.Worksheets
If ws.CodeName <> "Sheet3" Then
ws.Visible = xlVeryHidden
Next ws
end Sub
How can I allow to hide sheets in my locked workbook? The code below doesn't work.
I receive Error 1004: Application-defined or object-defined error.
If I unlock my workbook than the code passes.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
For Each ws In ThisWorkbook.Worksheets
If ws.CodeName <> "Sheet3" Then
ws.Visible = xlVeryHidden
Next ws
end Sub
Last edited: