after pressing enter move selection direction in excel

pmeghnathi

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

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

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