+ Reply to Thread
Results 1 to 6 of 6

how to do ctrl + arrow key trigger function

  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    florida
    MS-Off Ver
    2007
    Posts
    46

    how to do ctrl + arrow key trigger function

    This is what i have, i got it from this forum. I want to make it so ctrl and the up arrow key must be pressed together to trigger it. so i know that ^ is the code for ctrl, and ive been trying ^UP, but then it says something about onkey and yeah idk. Any help greatly appreciated. Thanks!

    Sub AA()
    Application.OnKey "{UP}", "Increment"
    End Sub

    Sub Increment()
    On Error GoTo Last
    ActiveCell.Value = ActiveCell.Value + 1
    Last:
    End Sub

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: how to do ctrl + arrow key trigger function

    Hi,

    To trap the keystroke, you'll need to put some code in the workbook module:

    Please Login or Register  to view this content.
    Then, put the other code in a standard module:
    Please Login or Register  to view this content.
    Finally save, close and then reopen your workbook and it should work fine.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    01-28-2015
    Location
    florida
    MS-Off Ver
    2007
    Posts
    46

    Re: how to do ctrl + arrow key trigger function

    Thanks for the fast response. I'm a big beginner. Sorry but what is the difference between workbook module and standard module? Confused on how to implement this.

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: how to do ctrl + arrow key trigger function

    OK,

    Once you have excel open, hit ALT & F11 to open the VBA editor.

    If you don't have the project explorer window open in the top left, go to view > project explorer

    In the project explorer window doubleclick "ThisWorkbook" and in the blank window that opens paste the first section of code.

    Next go to Insert > Module and paste the next set of code in the window that appears.

    Close the VBA editor.

    Finally save, close and then reopen your workbook and it should work fine.

  5. #5
    Registered User
    Join Date
    01-28-2015
    Location
    florida
    MS-Off Ver
    2007
    Posts
    46

    Re: how to do ctrl + arrow key trigger function

    sweep, you are the man. thank you!! works like a charm. this is visual basic stuff is a lot of fun.

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: how to do ctrl + arrow key trigger function

    You're welcome - glad you're enjoying it!


    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. Ctrl + arrow key not working
    By DamienC in forum Excel General
    Replies: 9
    Last Post: 04-01-2016, 05:23 AM
  2. Ctrl + Arrow key isn't working the way I need it to
    By ipausa in forum Excel General
    Replies: 2
    Last Post: 01-29-2014, 11:00 AM
  3. CTRL + Arrow not working properly
    By rockets2010 in forum Excel General
    Replies: 2
    Last Post: 06-30-2011, 12:22 PM
  4. Can't use CTRL + Arrow to move
    By Dnsierra in forum Excel General
    Replies: 1
    Last Post: 12-12-2009, 03:09 PM
  5. [SOLVED] Ctrl+Shift+arrow
    By briansetondavis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2005, 10:06 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