+ Reply to Thread
Results 1 to 7 of 7

Application.Onkey Assistance

  1. #1
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Application.Onkey Assistance

    Guys:

    I'm drawing a blank right now. A few months ago I setup a workbook to track some purchases. In the date column (column 1), I built in code so that pressing the UP arrow would automatically incrememnt the date by one, and the down arrow would decrease the date by a day. I know for a fact that I used an Application.OnKey bit of code, but I cannot for the life of me remember what the code was, and where I placed it. To make matters worse, I cannot find the workbook itself to remind me.

    I THINK this is the code I had, but obviously it doesn't work:
    Please Login or Register  to view this content.
    Can anyone help me get the ball rolling again? I appreciate it.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Does this help?

    http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310
    Please Login or Register  to view this content.
    place the following in a seperate module

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Roy:

    I appreciate the link. I had already checked there though.

    Suited:

    I probably should have mentioned that I was already able to employ the OnKey code using a macro. But, I am almost possible that the last time I did it, I didn't have it refer to a macro. I may be wrong though.


    One follow up question: is there anyway to have the OnKey code refer to the PLUS key (on the numeric key pad). I can get it to work with the regular PLUS sign, but not the one on the numeric keypad.

    Thanks for the help.

  5. #5
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310
    Quote Originally Posted by BigBas
    Roy:

    I appreciate the link. I had already checked there though.

    Suited:

    I probably should have mentioned that I was already able to employ the OnKey code using a macro. But, I am almost possible that the last time I did it, I didn't have it refer to a macro. I may be wrong though.



    One follow up question: is there anyway to have the OnKey code refer to the PLUS key (on the numeric key pad). I can get it to work with the regular PLUS sign, but not the one on the numeric keypad.

    Thanks for the help.

    To the best of my knowlege need to call a seperate macro with the Onkey method, you cannot simply attach a line of code to the Onkey method as you have done.
    I tested the code I posted for you , are you having any trouble with it ?

    Offhand I do not know how to refer to the plus key on the numeric keypad.
    Probably best to make a seperate post.
    Last edited by SuitedAces; 02-15-2008 at 02:05 PM.

  6. #6
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Suited:

    The code works just fine. I guess I was just wondering if the OnKey method could run code without calling a module.

    Either way, thanks for your time.

  7. #7
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310
    You're welcomed and if recall correctly being application level you want to make sure to return those keys to a normal state before opening other workbooks.

    Please Login or Register  to view this content.
    Last edited by SuitedAces; 02-15-2008 at 07:15 PM.

+ 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