+ Reply to Thread
Results 1 to 3 of 3

Combo Box Scroll Bar

  1. #1
    Registered User
    Join Date
    09-16-2005
    Posts
    2

    Question Combo Box Scroll Bar

    I have Excel 2002 SP3

    I created 2 combo boxes. The 2nd combo box drop down is filled depending what is chosen on the first combo box. (.additem)

    When the user clicks on the 2nd combo box the drop down shows 1 result with a short scroll bar with arrows. If the user clicks the drop down again the full list (3 options) is shown.

    I hope this makes sense.
    thanks

  2. #2
    Dave Peterson
    Guest

    Re: Combo Box Scroll Bar

    Maybe it's a bug in your code.

    This kind of thing worked for me when I put 2 comboboxes on a userform:

    Option Explicit
    Private Sub ComboBox1_Change()
    Me.ComboBox2.Clear
    If Me.ComboBox1.ListIndex < 0 Then
    'do nothing
    Else
    Select Case Me.ComboBox1.ListIndex
    Case Is = 0:
    With Me.ComboBox2
    .AddItem "ABC-1"
    .AddItem "ABC-2"
    .AddItem "ABC-3"
    End With
    Case Is = 1:
    With Me.ComboBox2
    .AddItem "DEF-1"
    .AddItem "DEF-2"
    .AddItem "DEF-3"
    End With
    End Select
    End If
    End Sub
    Private Sub CommandButton1_Click()
    Unload Me
    End Sub
    Private Sub UserForm_Initialize()
    With Me.ComboBox1
    .AddItem "ABC"
    .AddItem "DEF"
    End With
    End Sub


    dlutchner wrote:
    >
    > I have Excel 2002 SP3
    >
    > I created 2 combo boxes. The 2nd combo box drop down is filled
    > depending what is chosen on the first combo box. (.additem)
    >
    > When the user clicks on the 2nd combo box the drop down shows 1 result
    > with a short scroll bar with arrows. If the user clicks the drop down
    > again the full list (3 options) is shown.
    >
    > I hope this makes sense.
    > thanks
    >
    > --
    > dlutchner
    > ------------------------------------------------------------------------
    > dlutchner's Profile: http://www.excelforum.com/member.php...o&userid=27310
    > View this thread: http://www.excelforum.com/showthread...hreadid=468126


    --

    Dave Peterson

  3. #3
    Registered User
    Join Date
    09-16-2005
    Posts
    2

    Works

    thanks Dave.

    Using your code I was able to work out the problem.

    1. I am not using userforms this is by design.
    2. I had the wrong event on the wrong object. i.e.
    I had Private Sub ComboBox2_Click.
    I changed it to Private Sub ComboBox1_Change and all worked fine

+ 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