using groups in protected worksheet

L

lundgrendaniel

Hi,

I have grouped cells by using data/group and outline/group and after
that I have protected the worksheet through tools/protection/protect.
Now when I am in protection mode I cannot open (or close) a group. Is
it possible to have a worksheet protected but allowing users to
open(close) groups?
 
J

JulieD

Hi

if you protect the sheet via code you can enable this functionality. It's
best to put this code against the Workbook_Open event so that it gets run
each time the workbook is opened (macros have to be enabled, of course).

Private Sub Workbook_Open()
With Worksheets("Sheet1")
.Protect Password:="pwd", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub

---
substitute your sheet name for Sheet1 above.

to use the code, right mouse click on a sheet tab and choose view code -
this will display the VBE window. On the left you should see the name of
your workbook in bold (and brackets) under that you should have the sheets
listed and then ThisWorkbook. Double click on ThisWorkbook and paste the
code on the right hand side of the screen. now save and close the workbook
and reopen it and Sheet1 should be protected but with the ability to hide /
display the groups.

Hope this helps
Cheers
JulieD
 

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