excel - VBA Hide all sheets that aren't being used in workbook -
i have many sheets in workbook. have main sheet/"form" called "je" , on sheet there buttons , macros lead other sheets in workbook. but, intention other users, not myself, use workbook. so, sheet being used visible @ given time. @ no time want more 1 sheet visible user. user can navigate workbook thru clicking buttons , cells in select sheets allow them navigate throughout entire workbook. have tried adding code 'thisworkbook' module doesn't seem working i'd like. when navigate 1 sheet , another, sheets remain visible when i'd them hidden i'm unsure of other modifications can make code below desired result. if can offer modifications or changes can make accomplish this, i'd appreciate it.
update: have added code 'thisworkbook' object:
option explicit private sub workbook_sheetactivate(byval sh object) dim mysh worksheet each mysh in thisworkbook.worksheets if mysh.name <> sh.name mysh.visible = 0 next mysh end sub
but, when go double-click values populate cells in main sheet ("je") run-time 1004 error. values still populate main sheet no longer navigates main sheet i'd like.
if knows of solution or mod can make, i'd appreciate it.
it should workbook_sheetactivate
:
private sub workbook_sheetactivate(byval sh object) dim mysh worksheet each mysh in thisworkbook.worksheets if mysh.name <> sh.name mysh.visible = 0 'zero - false, 1 - true, 2 - hidden next mysh end sub
Comments
Post a Comment