+ Reply to Thread
Results 1 to 2 of 2

change list in combo box

  1. #1
    Qaspec
    Guest

    change list in combo box

    I have a combo box called cb1 with a list of values (p1:p2). I have a secong
    combo box cb2 that i would like the list to change depending on what is
    chosen in cb1. If the first option is chosen I'd like the data in cells Q1:Q8
    to be the list and if the second option is chosen I'd like R1:R6 to be the
    list in CB2. Thanks for any help.

    Qaspec

  2. #2
    sebastienm
    Guest

    RE: change list in combo box

    Hi,

    Assuming your comboboxes are in a userform, then use:

    Private Sub cb1_Change()
    Dim pos As Long
    pos = cb1.ListIndex

    If pos = 0 Then 'Case first item is chosen
    cb2.RowSource = "Sheet1!Q1:Q8"
    ElseIf pos = 1 Then 'Case second item is chosen
    cb2.RowSource = "Sheet1!R1:R6"
    Else 'Case else
    cb2.RowSource = ""
    End If
    End Sub

    --
    Regards,
    Sébastien
    <http://www.ondemandanalysis.com>


    "Qaspec" wrote:

    > I have a combo box called cb1 with a list of values (p1:p2). I have a secong
    > combo box cb2 that i would like the list to change depending on what is
    > chosen in cb1. If the first option is chosen I'd like the data in cells Q1:Q8
    > to be the list and if the second option is chosen I'd like R1:R6 to be the
    > list in CB2. Thanks for any help.
    >
    > Qaspec


+ 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