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

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -