Thread: Enter Key
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
bw bw is offline
external usenet poster
 
Posts: 74
Default Enter Key

Thanks for the information, Tom, but when the sheet is PROTECTED, and
"Move Selection after Enter" is NOT checked, the Enter Key Moves to a
different cell (Right, Left, Down, or Up...whichever was last selected).

You don't need code to verify the statement above.

But still, I have the following code anyway (now), and it doesn't work
either.

Sub NoMoveAfterReturn()
If ActiveSheet.ProtectContents = True Then 'PROTECTED
ActiveSheet.Unprotect
Application.MoveAfterReturn = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
Else 'UNPROTECTED
Application.MoveAfterReturn = False
End If
End Sub

I'm still looking for a suggestion that will work when the sheet is
protected.

Thanks,
Bernie


On Thu, 23 Sep 2004 21:00:50 -0400, Tom Ogilvy wrote:

When you do Tools=Protect=worksheet, you have 3 choices. So there are
three properties to check (plus there is one more property that can be
protected, but only with code).

Worksheet object properties:
protectionMode
protectContents
protectscenarios
protectDrawingObjects

if any of them are true, then the sheet is protected.