Sheet Protection - Grouping

C

carlyman

I want to protect a worksheet; however, I don't want to lose the ability
to collapse/uncollapse rows that I have grouped together.

What option needs to be checked when locking the sheet to allow this?
Or, is it not possible?

Thanks,
JC
 
D

Dave Peterson

If you already have the outline applied, you can protect the worksheet in code
(auto_open/workbook_open??).

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
End Sub

(I wasn't sure what caused your outlining--data|Group or Data|subtotals).)

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
C

carlyman

Thanks Dave, but is it possible to do without using Macros? I try to
avoid them as much as possible unless absolutely necessary.

I grouped the rows by going to "Data -> Group and Outline -> Group"

Again, thanks for your help.
JC
 
D

Dave Peterson

You can do it manually, but you'd still have to do it each time you open the
workbook.

Open the workbook.
hit alt-f8 (to get to the VBE -- where those macros live!)
hit ctrl-r (to see the project explorer -- like windows explorer)
find your workbook/project and click on it
hit the asterisk on the number keypad, not shift-8
this will expand all the levels of the project.

Look for your worksheet name and click on it
hit F4 to see its properties.

Look for the Enableoutlining property and change that to True.

======
The macro doesn't look too bad, huh?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top