+ Reply to Thread
Results 1 to 7 of 7

Userform Combobox behavior on Keydown

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    Smoketown, PA
    MS-Off Ver
    Excel Professional 2010
    Posts
    13

    Userform Combobox behavior on Keydown

    Greetings,
    I have a combobox in a userform I'd like to modify.
    User tabs into the combobox (currently this is just fine).
    On keydown, display the drop down (also fine).

    On key down again, cycle through the items in the dropdown. When it gets to the last item, I'd like it to start over from the top and visa versa.

    Right now strange things happen- it goes 1 to 3 on keydown and on the next keydown selects the final item, skips the next text box and shifts the focus to next item on my userform.

    Thanks in advance for your help.

    Please Login or Register  to view this content.

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

    Re: Userform Combobox behavior on Keydown

    When I try the code with a simple setup it seems to skip up and down 2 items at a time.

    Can you attach a sample workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Last edited by Norie; 03-12-2013 at 01:21 PM.
    If posting code please use code tags, see here.

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Userform Combobox behavior on Keydown

    It's all very strange. I think you might have to disable the other controls.

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

    Re: Userform Combobox behavior on Keydown

    I came up with this to use the down key in a combobox, still working on the up.
    Please Login or Register  to view this content.
    Still trying to get something similar for the up key.

  5. #5
    Registered User
    Join Date
    03-06-2013
    Location
    Smoketown, PA
    MS-Off Ver
    Excel Professional 2010
    Posts
    13

    Re: Userform Combobox behavior on Keydown

    sample.xls


    Yes! That's part of the problem I'm having.
    And when I try the up key, it gets stuck at the top.
    (I do want to have a blank as a possible option - that part isn't a mistake.)

    Thanks much.

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

    Re: Userform Combobox behavior on Keydown

    The code I posted works for the down key.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-06-2013
    Location
    Smoketown, PA
    MS-Off Ver
    Excel Professional 2010
    Posts
    13

    Re: Userform Combobox behavior on Keydown

    Quote Originally Posted by Norie View Post
    The code I posted works for the down key.
    Thanks, that works beautifully. I'll try my hand at reversing it for the up key.

+ 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