+ Reply to Thread
Results 1 to 4 of 4

VBA code to run macro with Enter key

  1. #1
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    VBA code to run macro with Enter key

    I enter an account name in cell Q3
    Cell R3 returns the worksheet row for the name in Q3.

    R3=IFERROR(MATCH(B3,B8:B986,0)+ROW(H8:H986)-1,"Not Located")

    I currently have a button to run a macro, GoToAccount(), to go to the row where the Account name is located.

    How can I modify the macro to go to the selected row by pressing the Enter key after I enter the account name in cell Q3? I would still like to also be able to run the macro from the button if desired.

    Please Login or Register  to view this content.

    Thanks

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA code to run macro with Enter key

    1) Right click the sheet tab and select VIEW CODE. This will open the SHEET MODULE for that sheet where event code can be used.

    2) Paste in this Event macro into that sheet module:

    Please Login or Register  to view this content.
    3) Close the editor. That macro will watch cell Q3, anytime you manually edit that cell it will trigger your GoToAccount macro.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: VBA code to run macro with Enter key

    Thanks, so much, works perfect.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA code to run macro with Enter key

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 2
    Last Post: 07-13-2013, 01:10 AM
  2. VBA -- pouse code to enter data in a worksheet, and then resume code
    By jcm4ccc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2013, 12:59 PM
  3. Code for Macro to Tab and enter
    By exc1967 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2012, 10:02 AM
  4. [SOLVED] VBA Code to Enter File Name, Activate the File, and Run Macro on File
    By DHartwig35805 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-09-2012, 03:49 PM
  5. Code in cell but need to do Alt-Enter and put more code
    By comptechbranden in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-07-2007, 12:57 PM

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