Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter Key
We can use ToolsOptionsEditDirection to control the behaviour of the
Enter Key, but is there a way to have the Enter Key stay in the same cell? I have removed the check mark from "Move Selection after Enter" to no avail. Thanks, Bernie |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter Key
Bernie
Unchecking should do it but... You can certainly set this via code. This could either be in the workbooks open even or you could use it as a toolbar button and toggle it on/off (as per the code sample) Sub moveAfterReturnNo() If Application.MoveAfterReturn = False Then Application.MoveAfterReturn = xlDown Exit Sub End If Application.MoveAfterReturn = False End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "bw" wrote in message news:opsesoiborvzdmg1@bw... We can use ToolsOptionsEditDirection to control the behaviour of the Enter Key, but is there a way to have the Enter Key stay in the same cell? I have removed the check mark from "Move Selection after Enter" to no avail. Thanks, Bernie |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter Key
Thanks, Nick!
For some reason, "Unchecking" now works??? In any case, I appreciate the code, and I'll save it for possible later use. Bernie On Thu, 23 Sep 2004 20:54:05 +0100, Nick Hodge wrote: Bernie Unchecking should do it but... You can certainly set this via code. This could either be in the workbooks open even or you could use it as a toolbar button and toggle it on/off (as per the code sample) Sub moveAfterReturnNo() If Application.MoveAfterReturn = False Then Application.MoveAfterReturn = xlDown Exit Sub End If Application.MoveAfterReturn = False End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter Key
Nick,
I discovered why "Unchecking" didn't work. The Sheet is Protected, and "Unchecking" doesn't work when the sheet is protected. Also, "If ActiveSheet.Protect = True Then" is always False. Do you have a solution to this problem? Thanks, Bernie On Thu, 23 Sep 2004 20:54:05 +0100, Nick Hodge wrote: Bernie Unchecking should do it but... You can certainly set this via code. This could either be in the workbooks open even or you could use it as a toolbar button and toggle it on/off (as per the code sample) Sub moveAfterReturnNo() If Application.MoveAfterReturn = False Then Application.MoveAfterReturn = xlDown Exit Sub End If Application.MoveAfterReturn = False End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter Key
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. -- Regards, Tom Ogilvy "bw" wrote in message news:opsessf8zmvzdmg1@bw... Nick, I discovered why "Unchecking" didn't work. The Sheet is Protected, and "Unchecking" doesn't work when the sheet is protected. Also, "If ActiveSheet.Protect = True Then" is always False. Do you have a solution to this problem? Thanks, Bernie On Thu, 23 Sep 2004 20:54:05 +0100, Nick Hodge wrote: Bernie Unchecking should do it but... You can certainly set this via code. This could either be in the workbooks open even or you could use it as a toolbar button and toggle it on/off (as per the code sample) Sub moveAfterReturnNo() If Application.MoveAfterReturn = False Then Application.MoveAfterReturn = xlDown Exit Sub End If Application.MoveAfterReturn = False End Sub |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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). I couldn't reproduce that behavior. When I unchecked it and edited an unlocked cell (protected sheet), when I hit enter, the highlight did not move. Maybe it isn't clear what you are saying. -- Regards, Tom Ogilvy "bw" wrote in message news:opses6c3b8vzdmg1@bw... 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. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter Key
I don't understand why you can make it work, and I can't?
I format cells A1:A3 as "Unlocked", then when I Protect the Sheet and "Select Unlocked Cells" only. I then uncheck "Move selection on Enter". When I enter information into cell A1 and press Enter, the focus moves to Cell A2. Again, I don't understand why you can make it work, and I can't? Bernie On Thu, 23 Sep 2004 22:18:39 -0400, Tom Ogilvy wrote: 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). I couldn't reproduce that behavior. When I unchecked it and edited an unlocked cell (protected sheet), when I hit enter, the highlight did not move. Maybe it isn't clear what you are saying. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter Key
I could reproduce the behavior if I set the enableselection property of the
worksheet to xlUnlockedCells. If no restriction, it worked as expected. -- Regards, Tom Ogilvy "bw" wrote in message news:opsetw76k7vzdmg1@bw... I don't understand why you can make it work, and I can't? I format cells A1:A3 as "Unlocked", then when I Protect the Sheet and "Select Unlocked Cells" only. I then uncheck "Move selection on Enter". When I enter information into cell A1 and press Enter, the focus moves to Cell A2. Again, I don't understand why you can make it work, and I can't? Bernie On Thu, 23 Sep 2004 22:18:39 -0400, Tom Ogilvy wrote: 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). I couldn't reproduce that behavior. When I unchecked it and edited an unlocked cell (protected sheet), when I hit enter, the highlight did not move. Maybe it isn't clear what you are saying. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to select cells in column enter data then press enter | New Users to Excel | |||
Enter multiple numbers in a cell so total shows when enter keypres | Excel Worksheet Functions | |||
Enter info in one sheet, auto enter in another based on one field | New Users to Excel | |||
Auto enter date when data in enter in another cell | Excel Worksheet Functions | |||
What does hitting Ctrl + Shift + Enter to enter a formula do??? Help a n00b out. | Excel Worksheet Functions |