how to capture enter key inside a cell

H

helpwithXL

hi
just wondering if its possible to capture the pressing of enter key in
excel?.
normally if enter key is pressed in cell, next cell is selected. I want
to change (over ride) this behaviour of enter key. i want that when
user presses enter key inside the cell, the cursor should go to next
line in the same cell. right now "alt" key needs to pressed to achieve
this but is it possible to capture this event when enter key is pressed
so that i can change what it does.
any help is appreciated.

regards,
helpwithxl
 
A

Andibevan

There is a setting under tools>Options>Edit> Move Selection after enter -
select this tick box and then change the direction as appropriate.

Don't know the VBA for this but you could find out probably using a recorded
macro.
 
G

Guest

You can change the behaviour of the Enter key to any point in the compass
with this:

Application.MoveAfterReturnDirection = xlDown

The compass constants are: xlToLeft, xlToRight, xlUp, or xlDown
 
N

Nigel

Not sure about other version of Excel but in xl2002 you can set the option
enter cell behaviour direction. Use
Tools->Options->Edit -'Move Selection After Enter' and 'Direction - Down
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top