bluepenink
Well-known Member
- Joined
- Dec 21, 2010
- Messages
- 585
Hi all
I have the following macro in a module to protect/unprotect workbook...it's working fine but i have a few columns "grouped" so when i try to "ungroup" them, it says, sheet is protected.
i have tried to define it in the macro so not sure what I am doing wrong.
I am using Excel 2013.
also, can it also be added on the macro to disable "hide/unhide" sheet feature?
I have the following macro in a module to protect/unprotect workbook...it's working fine but i have a few columns "grouped" so when i try to "ungroup" them, it says, sheet is protected.
i have tried to define it in the macro so not sure what I am doing wrong.
I am using Excel 2013.
also, can it also be added on the macro to disable "hide/unhide" sheet feature?
Code:
Private Sub Unprotect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="78749"
Next ws
End Sub
Private Sub ProtectAllSheets()
'
' Protect all sheets in a workbook
' Macro recorded XXX
'
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="78749", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingColumns:=True
ws.EnableSelection = xlNoRestrictions
Next ws
End Sub
Last edited by a moderator: