ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to force <enter to behave like <alt + <enter within a cell (https://www.excelbanter.com/excel-programming/335783-how-force-enter-behave-like-alt-enter-within-cell.html)

luckyinky

How to force <enter to behave like <alt + <enter within a cell
 
I want the cursor to go to the next line within a cell when the user presses
the <enter key. Does anyone know how to do this?

Tom Ogilvy

How to force <enter to behave like <alt + <enter within a cell
 
Alt+Enter does what you want. enter is not supported for this this and
macros essentially don't run while editing a cell.

--
Regards,
Tom Ogilvy

"luckyinky" wrote in message
...
I want the cursor to go to the next line within a cell when the user

presses
the <enter key. Does anyone know how to do this?




luckyinky

How to force <enter to behave like <alt + <enter within a c
 
Tom,
Thanks for the reply. I realize that <alt + <enter does what I want it
to but I need to "overload" the <enter key to act like <alt + <enter. Is
there no way to do this? i.e. via a Macro or some other VBA code

"Tom Ogilvy" wrote:

Alt+Enter does what you want. enter is not supported for this this and
macros essentially don't run while editing a cell.

--
Regards,
Tom Ogilvy

"luckyinky" wrote in message
...
I want the cursor to go to the next line within a cell when the user

presses
the <enter key. Does anyone know how to do this?





Tom Ogilvy

How to force <enter to behave like <alt + <enter within a c
 
Perhaps you could do something like this:

Public Sub SetKey()
Application.OnKey "~", "rTurn"
End Sub

Public Sub UnSetKey()
Application.OnKey "~"
End Sub

Sub rTurn()
ActiveCell.Value = ActiveCell.Value & Chr(10)
SendKeys "{F2}{End}{Right}"
End Sub


--
Regards,
Tom Ogilvy

"luckyinky" wrote in message
...
Tom,
Thanks for the reply. I realize that <alt + <enter does what I want

it
to but I need to "overload" the <enter key to act like <alt + <enter.

Is
there no way to do this? i.e. via a Macro or some other VBA code

"Tom Ogilvy" wrote:

Alt+Enter does what you want. enter is not supported for this this and
macros essentially don't run while editing a cell.

--
Regards,
Tom Ogilvy

"luckyinky" wrote in message
...
I want the cursor to go to the next line within a cell when the user

presses
the <enter key. Does anyone know how to do this?








All times are GMT +1. The time now is 03:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com