ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Protecting cells but maintaing data groups (https://www.excelbanter.com/excel-discussion-misc-queries/125725-protecting-cells-but-maintaing-data-groups.html)

DannyS

Protecting cells but maintaing data groups
 
I have a sheet that has data groups (Data | Group and Outline | Group) that
are used to minimise and maximise the rows shown. I want to protect some
rows from edit, but when I do so the user can no longer use the + and - signs
by the rows that can be expanded.

Is there any way of protecting cells without disabling the maximise/minimise
available via data grouping?

I can provide an example spreadsheet if it helps?

Thanks very much in advance for any help, Dan

Dave Peterson

Protecting cells but maintaing data groups
 
If you already have the outline/subtotals/autofilter 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

It needs to be reset each time you open the workbook. (Earlier versions of
excel don't remember it after closing the workbook. IIRC, xl2002+ will remember
the setting under tools|Protection|protect sheet.)

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

DannyS wrote:

I have a sheet that has data groups (Data | Group and Outline | Group) that
are used to minimise and maximise the rows shown. I want to protect some
rows from edit, but when I do so the user can no longer use the + and - signs
by the rows that can be expanded.

Is there any way of protecting cells without disabling the maximise/minimise
available via data grouping?

I can provide an example spreadsheet if it helps?

Thanks very much in advance for any help, Dan


--

Dave Peterson

DannyS

Protecting cells but maintaing data groups
 

Thanks Dave, I appreciate the help.


"Dave Peterson" wrote:

If you already have the outline/subtotals/autofilter 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

It needs to be reset each time you open the workbook. (Earlier versions of
excel don't remember it after closing the workbook. IIRC, xl2002+ will remember
the setting under tools|Protection|protect sheet.)

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

DannyS wrote:

I have a sheet that has data groups (Data | Group and Outline | Group) that
are used to minimise and maximise the rows shown. I want to protect some
rows from edit, but when I do so the user can no longer use the + and - signs
by the rows that can be expanded.

Is there any way of protecting cells without disabling the maximise/minimise
available via data grouping?

I can provide an example spreadsheet if it helps?

Thanks very much in advance for any help, Dan


--

Dave Peterson



All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com