Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 3 of 3

Thread: VBA: Enter Key control?

  1. #1
    Join Date
    10th July 2003
    Posts
    7
    In a listbox of item numbers.

    I can successfully mouse click any item number in the list and the matching item is selected on the main sheet.

    If a keyboard letter key is selected the first of the corresponding item numbers that starts with that letter (if any) is selected and I can continue to scroll through those corresponding item numbers by continuing to press the same letter key.

    Butů. the enter key will not select the item the same as mouse clicking will.

    Is it possible to program the enter key to act the same as a mouse click?

    Also, using the keyboard up-down arrow keys will scroll through the items in the list and also select the matching item on the sheet concurrently.

    Is it possible to disable the up-down arrows from having any control on my sheet?

    Thank you

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    8th October 2005
    Posts
    3

    Re: VBA: Enter Key control?

    Hi

    I'm sorry, I don't have a reply to your question, however I am looking for a solution to selecting items in a listbox after keypress

    you wrote

    If a keyboard letter key is selected the first of the corresponding item numbers that starts with that letter (if any) is selected and I can continue to scroll through those corresponding item numbers by continuing to press the same letter key.

    I am interested in how you solved this

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    7th March 2003
    Location
    Essex, England
    Posts
    11,314

    Re: VBA: Enter Key control?

    Hi,

    Assuming Listbox from the Control toolbox is being used on a worksheet.
    VB:
    Private Sub ListBox1_Change() 
         ' update linked cell when item changed via keypress
        Range(ListBox1.LinkedCell) = ListBox1.Value 
    End Sub 
    Private Sub ListBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) 
         ' diable arrow key selection
        If KeyCode = 38 Or KeyCode = 40 Then 
            KeyCode = vbNull 
        End If 
    End Sub 
    
    
    Macrules, the selection by keypress is a built-in function of the listbox from the Control Toolbox. The listbox from the Forms toolbar does not support this.

    Cheers
    Andy


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Replies: 2
    Last Post: April 23rd, 2008, 12:49
  2. Replies: 12
    Last Post: January 10th, 2008, 14:08
  3. Control Cursor Movement On Enter
    By jfmercier in forum EXCEL HELP
    Replies: 5
    Last Post: September 6th, 2007, 05:41
  4. Control Shift Enter in VBA
    By Hazy in forum EXCEL HELP
    Replies: 8
    Last Post: April 22nd, 2006, 02:08
  5. Replies: 3
    Last Post: October 25th, 2004, 11:13

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
  •  
porno