View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Returned position address on protected sheet

Ben's suggestion makes sense because you only need to reference a range
to act on it, *and* in this case it retriggers the event. The way you
had the EnableSelection set in your code sample, it puts ActiveCell
into EditMode whenever a user double clicks outside the unlocked area.

So...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target, Range("E1:F" & lastrow)) Is Nothing Then Exit
Sub

With ActiveSheet
.Cells.Locked = True
.Range("E1:F" & lastrow).Locked = False

.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
UserInterfaceOnly:=True

.EnableSelection = xlNoRestrictions
End With
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion