ALT+ENTER in VBA

  • Hello!


    Is it possible to replace the function of ENTER key with the combination ALT+ENTER in VBA?
    More specifically, I want to make sure that while typing a string into a cell, when ENTER is pressed, instead of moving the selection in the next cell, the typing is continued in the same cell (simulating the ALT+ENTER combination).
    I tried the following combination:

    Code
    Private Sub Workbook_Open()
    Application.OnKey "~", "actions"
    End Sub


    with


    Code
    Sub actions()
    SendKeys ("%~")
    End Sub


    This solution seems to enter into a loop.


    Thank you!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!