![]() |
Outlines and Locked Worksheet: XL97
Hi There,
I have underneath sub to protect my locked cells ... Standing on a locked cell prevents me to use (click) my outlines (XL97!). OK, I understand that it does ...what it does! But maybe there is a workaround? Best Regards Sige Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If Target.Locked = True Then Me.Protect Password:="" Else Me.Unprotect Password:="" End If End Sub |
Outlines and Locked Worksheet: XL97
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 Sige wrote: Hi There, I have underneath sub to protect my locked cells ... Standing on a locked cell prevents me to use (click) my outlines (XL97!). OK, I understand that it does ...what it does! But maybe there is a workaround? Best Regards Sige Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If Target.Locked = True Then Me.Protect Password:="" Else Me.Unprotect Password:="" End If End Sub -- Dave Peterson |
Outlines and Locked Worksheet: XL97
.EnableOutlining = True
Thx Dave! Dave Peterson wrote: 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 Sige wrote: Hi There, I have underneath sub to protect my locked cells ... Standing on a locked cell prevents me to use (click) my outlines (XL97!). OK, I understand that it does ...what it does! But maybe there is a workaround? Best Regards Sige Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If Target.Locked = True Then Me.Protect Password:="" Else Me.Unprotect Password:="" End If End Sub -- Dave Peterson |
All times are GMT +1. The time now is 10:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com