+ Reply to Thread
Results 1 to 6 of 6

Need VBA code to replicate "Enter" key from active cell

  1. #1
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Need VBA code to replicate "Enter" key from active cell

    Am using code found below to autosize 3 columns to fit the values that they return. The results are dependent on inputs from combinations of 3 other cells, and entry into those cells will change the results of the columns. The results work fine, but the now rezised columns D:F remain selected after changing one of the 3 cells. Am looking for a way to accomplish the following:

    After changing the value in the entry cells is to just have the active cell remain where it was directed to go, either by using the tab, or enter key, down arrow, etc. So, if I change the value in B1 and use the down arrow for example, B2 would be selected after resizing the 3 columns. Or using the tab key, C1 would be selected after resizing the columns.





    Please Login or Register  to view this content.
    I've tried recording code to replicate "enter", but nothing gets captured.

    TIA for any modifications to the code.
    Pete

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Need VBA code to replicate "Enter" key from active cell

    Peter

    Does it do what you want if you don't select anything?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Need VBA code to replicate "Enter" key from active cell

    This is where Select becomes redundant, or in this case a nuisance.

    Try changing to this
    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Need VBA code to replicate "Enter" key from active cell

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Need VBA code to replicate "Enter" key from active cell

    We should probably point out that those three columns will be resized every time you make a change to any cell on the worksheet.


    Regards, TMS

  6. #6
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Need VBA code to replicate "Enter" key from active cell

    This works well. All posts did the trick, as well as provided useful information Thank you.

    Peter

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find "TEXT 1" in a range and enter "TEXT 2" in the adjacent cell
    By madreag in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-28-2013, 05:34 PM
  2. "Form and macro" to delete "Active" cell contents.
    By wanty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 11:33 PM
  3. [SOLVED] Macro to look up and down from the active cell, copying the active "section" of the sheet
    By mikkola in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2013, 07:21 PM
  4. Replies: 0
    Last Post: 11-20-2012, 10:22 AM
  5. Can I enter a "Y" and return "Yes" in the same cell? PART 2
    By rbbbbeee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2006, 07:25 AM

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