View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
[email protected] hojikuru@yahoo.co.jp is offline
external usenet poster
 
Posts: 8
Default Protect sheet while enabling outlines and custom views

This approach seems unstable, particularly since my workflow depends
heavily on custom views, which don't seem to do well with protection.
I think my best bet will be to go with an unprotected workbook, but
detect when a user tries to select a member of a Named Range. I would
send him to cell A1. In this case, here's what I'm trying to do, but
it doesn't work ...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("AGRegionsProtected").Address Then
ActiveCell = Range("A1").Select
End Sub

As a secondary concern, I'd also like to have a pop-up explain what is
going on. I could use this code:
MsgBox "This area is automatically calculated and should not be
altered.", vbCritical, Error

As a completely different approach, setting the scroll area to exclude
the range I want to protect (in this case, AGRegionsProtected), may
work.

This is difficult since the workbook must be shared, I have outlines
and custom views ... all in one.

TIA,
ML.


Dave Peterson wrote in message ...
Your code will look something like:

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


But since you don't want to change protection, you can comment that line out by
putting an apostrophe in front of it:

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

Try it and see what happens--but don't get your hopes up.
[snip]