Excel protect and unprotect workbook VBA -
i have workbook contains several (lookup) tabs don't want users able unhide. however, there 1 tab contains admin info admin users able see. have button , macro prompts admin password before unhiding tab, if protect workbook structure (so hidden tabs not accessible other users) vba fails. there no way protect/unprotect workbook within admin macro? have tried various combinations of activeworkbook.unprotect
, activeworkbook.protect
, activeworkbook.protectstructure
no avail - both within admin macro , workbookopen. error msg commonly encounter "can't assign read-only property" after having activeworkbook.unprotect
@ top of code. know how work around this? don't want have leave tabs open being unhidden second password on admin worksheet - clumsy!
instead of protecting whole workbook, set visible
property of sheets want hide xlsheetveryhidden
- can manually in properties window of vba editor. sheets won't show in unhide…
dialog. macro swap visibility of admin-only sheet xlsheetveryhidden
xlsheetvisible
, back.
by doesn't protect workbook user knows how access vba editor , properties, if need there seem lot of answers quick web search - may depend on version of excel.
Comments
Post a Comment