Macro to [ALt]&[Enter] Whilst Typing

Roj47

Board Regular
Joined
May 4, 2011
Messages
71
Office Version
  1. 365
Platform
  1. Windows
Part of me thinks this is being lazy, but another part is thinking that most macros are to save time anyhow.

I am having trouble pressing Alt and Enter in a cell to insert a new line, so looking for a Macro.

I have recorded the action, but the macro attached to a button can not be selected whilst typing.

Does anyone know how to be able to activate a macro whilst typing?

Many thanks.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Part of me thinks this is being lazy, ...
... I am having trouble pressing Alt and Enter in a cell to insert a new line

No way, that's not lazy at all! :)

Well, one way is to use Autocorrect.

Ex., use the sequence "||" to be replaced with the newline (or any other sequence you want).

Execute:

Code:
Application.AutoCorrect.AddReplacement "||", Chr(10)

Now write in a cell "abc||def". You'll see that the newline is inserted automatically.

Is this a good solution?
 
Upvote 0
Thank you for the code, but I am unsure where to locate it to run automatically.

I attached it to the tab as :

Sub Copy_Formula()
Private Sub Worksheet_Activate()
Application.AutoCorrect.AddReplacement "||", Chr(10)
End Sub

But it would not work.

I know I am a bit slow, but starting to understand.

From what you have written it is perfect for what I am in need of and of course the || could be replaced with a differing symbol that I never use.

Kind regards
 
Upvote 0

Forum statistics

Threads
1,224,567
Messages
6,179,568
Members
452,926
Latest member
rows and columns

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