Excel: Allowing grouping/outlining on multiple worksheets with protection on -


i trying allow grouping/outlining on multiple worksheets have protection turned on. reason excel doesn't have simple option box when protecting- i'm using macro code:

sub group() activesheet.enableoutlining = true' activesheet.protect contents:=true, userinterfaceonly:=true end sub 

i set auto-run macro when workbook opened. issue have want apply sheets, not active sheet. code aboves works on active sheet, still have manually run macro on other sheets allow outlining work.

i need flexibility in worksheets added or deleted, , want code flexible affects worksheets without me having name every worksheet in code.

is possible?

thank you.

the should be:

option explicit sub group() dim ws worksheet  each ws in thisworkbook.worksheets     ws         .protect contents:=true, userinterfaceonly:=true         .enableoutlining = true 'add after adding protection sheet     end next ws 'you need next rule "for" routine. end sub 

greetings paul


Comments

Popular posts from this blog

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -