RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a bit of code to make the ENTER key add a carriage return whilst entering text into cell:
but this will only put a new line at the end of the existing content in a cell.
Is there a way to do this but to simulate ALT + {ENTER} ?.. So that it inserts the linebreak at the point of the cursor and not at the end. I've looked everywhere, but I can't find anything...
If you can point me in the right direction, I'd be very grateful
Thanks
Code:
Sub HookEnterKey()
Application.OnKey "{RETURN}", "carriage_return"
Application.OnKey "{ENTER}", "carriage_return"
End Sub
Sub carriage_return()
ActiveCell = ActiveCell & Chr(10)
SendKeys "{F2}"
DoEvents
SendKeys "{F2}"
End Sub
Is there a way to do this but to simulate ALT + {ENTER} ?.. So that it inserts the linebreak at the point of the cursor and not at the end. I've looked everywhere, but I can't find anything...
If you can point me in the right direction, I'd be very grateful
Thanks
Last edited: