after pressing enter move selection direction in excel

pmeghnathi

Board Regular
Joined
Mar 11, 2018
Messages
98
Office Version
  1. 2003 or older
Platform
  1. Windows
A1 cell data entry press enter key move direction A10,after press enter key to move B1, after to B10 pl.help
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
AFAIK, there is no key press events at the worksheet level, so you need to get creative.
You could adapt very complicated code such as this
or you could use the OnKey approach as shown here:

Note that for the latter, you will need to run the OnKey code at some point - could be workbook activate or open or a command button (button would allow you to cycle the key code on and off while using a sheet). However, you should also run the code that deactivates OnKey at some point, otherwise I suspect it will behave that way for every workbook you open. Again, use a button if you want to turn off the effect before closing the wb, but certainly turn it off (by deactivate or turn off I mean return the Enter key to its default behaviour).

Or you could just skip all the hard work and use mouse or navigation keys.
 
Upvote 0
You could try something like this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
 If Not Intersect(Target, Range("A:ZZ")) Is Nothing Then

    If Target.Row = 2 Then
        Target.Offset(8, 0).Select
    Else
        Target.Offset(-10, 1).Select
    End If
 End If
 
End Sub
 
Upvote 0
Solution
You could try something like this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
 If Not Intersect(Target, Range("A:ZZ")) Is Nothing Then

    If Target.Row = 2 Then
        Target.Offset(8, 0).Select
    Else
        Target.Offset(-10, 1).Select
    End If
 End If
 
End Sub
Thanks
 
Upvote 0
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top