Hi there,
Can anyone suggest some VBA to hide/unhide a named range based on whether a workbook is 'in development' or not?
At the moment, I have the following 'in development' code to protect and unprotect all sheets in one go.
Ideally I would also like to hide specific named ranges when it is not in development, and then unhide them when I am in development.
Can anyone suggest some VBA to hide/unhide a named range based on whether a workbook is 'in development' or not?
At the moment, I have the following 'in development' code to protect and unprotect all sheets in one go.
Ideally I would also like to hide specific named ranges when it is not in development, and then unhide them when I am in development.
Code:
Public Sub SetProtectWorksheets()
Dim oSheet As Worksheet
For Each oSheet In ActiveWorkbook.Worksheets
If IN_DEVELOPMENT = True Then
oSheet.Unprotect PROTECT_PASSWORD
oSheet.EnableSelection = xlNoRestrictions
ActiveWindow.DisplayWorkbookTabs = True
End If
If IN_DEVELOPMENT = False Then
oSheet.Protect PROTECT_PASSWORD
oSheet.EnableSelection = xlUnlockedCells
ActiveWindow.DisplayWorkbookTabs = False
End If
Next 'oSheet
End Sub