+ Reply to Thread
Results 1 to 11 of 11

Reprogram Enter Key on worksheet activate

  1. #1
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Reprogram Enter Key on worksheet activate

    Is there code for worksheet activate event that will reprogram the Enter Key to mimic the Tab Key such that if you hit Enter, the cell to the right of the active cell is selected? I've searched the net for several hours today and find nothing that addresses this question.

    Also, the Enter Key would have to be normalized on worksheet deactivate.

    Thanks for your help. J
    Last edited by jaslake; 09-07-2009 at 08:10 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Reprogram Enter Key on worksheet activate

    Place this bit of code in the sheet module. After making an entry into a cell and pressing the Enter key it will select the next cell to the right.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Reprogram Enter Key on worksheet activate

    Hi Palmetto. I appreciate your input and this line of code does indeed change the operation of the Enter key. Unfortunately, it's impact is erratic. I have other lines of code in the procedure that direct the cursor to specific cells and your line of code is "coat tailing" on the other code lines and sending the cursor to the wrong place.

    What I'm really interested in is an "Activate Event" on this particular worksheet that will allow the Enter Key to function the same as the Tab Key (move right). I've not seen this issue addressed on any website so I suspect it's not doable.

    Any other suggestions?

    Thanks. J

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Reprogram Enter Key on worksheet activate

    Perhaps in the sheet module (completely untested),
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Reprogram Enter Key on worksheet activate

    Thanks Shg...I believe that's got it. I'll play with it for a while to see if I can break it.

    By the way, I'm not getting email notifications. I don't know if the forum is being blocked by my mail server or what. I used to get them but had to reload the system. Perhaps you could provide me with the email address so I can add to my safe senders list.

    J

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Reprogram Enter Key on worksheet activate

    Shg...as you were aware (I wasn't), the code you provided changes the setup options in Excel such that the enter key is modified to move right upon pressing the key. And, that's exactly what I wanted it to do.

    Thus far, it appears that the code in the deactivate event does not "always" reset excel setup option to move down when the enter key is pressed. It appears to be inconsistent, sometimes it does and sometimes it doesn't.

    I'll keep playing with it to see if I can figure out when it does and when it doesn't but does anything come to mind for you?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Reprogram Enter Key on worksheet activate

    You may need to initialize iDir in the workbook Open event instead of the worksheet Activate event, in which case it needs to be a public variable in a code module.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Reprogram Enter Key on worksheet activate

    I'll try that. Any idea about the email issue?

    J

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Reprogram Enter Key on worksheet activate

    Check your subscription options, and if they're properly set, contact an admin.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Reprogram Enter Key on worksheet activate

    I received a runtime error on the Worksheet Deactivate line of code when iDir was initialized in Worksheet Open. So, I put eveything back according to your original code and then changed the Worksheet Deactivate line of code thus:
    Please Login or Register  to view this content.
    This seems to work for the moment. I've been playing with it for about 30 minutes and haven't broken it yet.

    Thanks for your help.
    J

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Reprogram Enter Key on worksheet activate

    That will work, as long as that's the direction you always use.

    The poinbt of caching it was to work with any direction.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1