Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: offset listbox selection

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Given: a userform with a listbox and an ok button. The listbox lists these names:

    jane doe
    john doe
    jill doe
    jim doe

    User selects jane, jane is stored in a variable. User clicks OK and an operation is performed. User is now ready for john but must select him manually.

    Is there a command that will offset the listbox selection down one?

    thanks in advance

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What do you mean by Offset in there ? remove it from the list ? select the next entry in the list ?
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    In a vb user form the following code was inserted into a command button. Every time the command button was clicked the selected item in the combobox was incremented by 1. Is that what your looking for ?
    Code:
    Private Sub CommandButton1_Click()
    ComboBox1.ListIndex = ComboBox1.ListIndex + 1
    End Sub

  4. #4
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The following VB code will remove the item from the ComboBox list:
    Code:
    Private Sub CommandButton1_Click()
    ComboBox1.RemoveItem (ComboBox1.ListIndex)
    ComboBox1.ListIndex = 0
    End Sub

  5. #5
    New Member
    Join Date
    Apr 2002
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Juan Pablo González
    What do you mean by Offset in there ? remove it from the list ? select the next entry in the list ?
    by "offset" I mean move down one, selecting the next entry in the list. If the list is for instance a roll call, then names must be checked in sequence one at a time

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •