Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change enter key direction based on range
Oh Wise Ones,
I jump back in forth between several workbooks throughout the day. Almost all of them I need the Enter key to move to the right when pressed. I know how to manually set the direction, but for the few ranges I need it to move down, can I have it programmatically switch directions only in that particular range? Many thanks, Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change enter key direction based on range
You might be able to adapt this into a Worksheet_Change with the Target range
being the control factor. I didn't test it. Set MyRange = ActiveSheet.Range("C5:C25") If Intersect(MyRange, Target) Then Application.MoveAfterReturn = True Application.MoveAfterReturnDirection = xlDown Else Application.MoveAfterReturnDirection = xlToRight End If "Mike K" wrote: Oh Wise Ones, I jump back in forth between several workbooks throughout the day. Almost all of them I need the Enter key to move to the right when pressed. I know how to manually set the direction, but for the few ranges I need it to move down, can I have it programmatically switch directions only in that particular range? Many thanks, Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change enter key direction based on range
Thanks JLG,
Didn't work when implemented as below: Private Sub Worksheet_Change(ByVal Target As Range) Set MyRange = ActiveSheet.Range("J3:L12") If Intersect(MyRange, Target) Then Application.MoveAfterReturn = True Application.MoveAfterReturnDirection = xlDown Else Application.MoveAfterReturnDirection = xlToRight End If End Sub Still moves to the right. This is what I figured the code would look like, but I'm not strong enough in vba to do it myself. Mike "JLGWhiz" wrote: You might be able to adapt this into a Worksheet_Change with the Target range being the control factor. I didn't test it. Set MyRange = ActiveSheet.Range("C5:C25") If Intersect(MyRange, Target) Then Application.MoveAfterReturn = True Application.MoveAfterReturnDirection = xlDown Else Application.MoveAfterReturnDirection = xlToRight End If "Mike K" wrote: Oh Wise Ones, I jump back in forth between several workbooks throughout the day. Almost all of them I need the Enter key to move to the right when pressed. I know how to manually set the direction, but for the few ranges I need it to move down, can I have it programmatically switch directions only in that particular range? Many thanks, Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to change the direction of the enter key to go horizontal | Excel Worksheet Functions | |||
change direction when pressing enter | Excel Discussion (Misc queries) | |||
How do I change the direction when pressing ENTER? (dn, rt, etc.) | Excel Worksheet Functions | |||
change direction when hitting enter key | Excel Discussion (Misc queries) | |||
How do I change the direction of the cell when I press enter | New Users to Excel |