how to change (override) enter key behaviour in a cell

H

helpwithXL

thanx to all who replied to my last post regarding enter key behaviour.
but problem is still not solved. i think i should have been more clear.
the moveAfterReturn method is only boolean type and it tells if the
enter key will be effective or not, that is, if moveAfterReturn = true
(by default),then pressing enter will take the user to next cell and if
moveAfterReturn = false then pressing enter will not have any effect at
all. moveAfterReturnDirection tells only direction in which cell
selection will move.
my problem is that i want to go to the next line in the SAME cell when
i press enter and not to the next cell. i can go to next line in same
cell by alt+enter (now also) but i have a specific requirement in which
i have to over ride enter key so that when user presses enter key , the
cursor remains in the same cell but on the next line.

TIA
regards
 
J

Jim Thomlinson

Look up the OnKey method in VBA help. I think that is what you want...

HTH
 
H

helpwithXL

thanx Jim,
this is exactly what i wanted but can u also tell how to make the
cursor go down when i'm editing the cell.
so with onKey i can assign a new sub whenever enter key is pressed but
how do i write this syntactically in the sub i assigned, that i want
the cursor to go down and have a line feed. i tried vbcrlf but it does
not work.

TIA
regards
 
J

Jim Thomlinson

As a guess without trying it you want to use SendKey to send the Alt Enter
keystroke

HTH
 

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