Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 124
Default Can I lock a worksheet and still be able to hide and show groups?

I want to protect a worksheet but still be able to hide and show groups but
cant seem to figure out how. Is it possible to do?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Can I lock a worksheet and still be able to hide and show groups?

Private Sub Worksheet_Activate()
With Me
.Protect Password:="justme", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that sheet module. Edit if desired the Alt + q to return to
the Excel window.


Gord Dibben MS Excel MVP

On Fri, 5 Sep 2008 14:54:01 -0700, Ryan
wrote:

I want to protect a worksheet but still be able to hide and show groups but
cant seem to figure out how. Is it possible to do?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Can I lock a worksheet and still be able to hide and show 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
'If .FilterMode Then
' .ShowAllData
'End If
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 allow autofilter setting under tools|Protection|protect sheet, but that
won't help when you're filtering via code.)

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Ryan wrote:

I want to protect a worksheet but still be able to hide and show groups but
cant seem to figure out how. Is it possible to do?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show or hide outlined data option in a protected worksheet? Listasista Excel Discussion (Misc queries) 3 April 4th 23 11:36 AM
How do I show or hide detail for a group in a protected worksheet Gilles FAURE Excel Discussion (Misc queries) 0 November 1st 06 01:47 AM
Can I lock rows together and then filter for content in groups? Captain Excel Discussion (Misc queries) 1 May 4th 06 03:09 PM
Show or Hide a worksheet with a macro Hasty Excel Discussion (Misc queries) 4 February 16th 06 08:54 PM
Hide/show worksheet Mal Excel Discussion (Misc queries) 5 March 29th 05 04:00 PM


All times are GMT +1. The time now is 09:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"