+ Reply to Thread
Results 1 to 7 of 7

Dependent comboboxes

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Dependent comboboxes

    Hi,

    This should get you started although the data validation would be just as easy. The ListFillRanges are the cities you want. The code goes into ComboBox1.

    Private Sub ComboBox1_Change()
    If ComboBox1.Value = "California" Then
    ComboBox2.ListFillRange = "N10:N11"
    End If
    If ComboBox1.Value = "Massachusetts" Then
    ComboBox2.ListFillRange = "O10:O11"
    End If
    If ComboBox1.Value = "Rhode Island" Then
    ComboBox2.ListFillRange = "P10:P11"
    End If
    End Sub

    You could also use SELECT/CASE arguments.

    HTH
    Steve
    Last edited by SteveG; 06-04-2012 at 04:07 PM. Reason: Explanation

  2. #2
    Registered User
    Join Date
    05-10-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Dependent comboboxes

    jefferybrown:

    Yeah, I strongly prefer comboboxes because my department is most certainly not computer savvy, to the extent where I'd rather not even have anything remotely hidden (such as the data validation arrows). The worksheet I attached will be part of a shared database so I'm making it as user-friendly as possible.


    SteveG:

    Let me try those, since what's also important is that it still works after I add more company information to the "Data" sheet.

    Edit: I looked over the code one more time and realized that having to manually name all the entries wouldn't fly too well with the constant adding of information and as well as the whole user-friendly theme. I guess I was looking for something more automated. For example, if I were to enter another company under the state of California or a new state altogether, then the comboboxes return the data accordingly.


    Thanks guys for the help so far!
    Last edited by ObiWanBaloney; 06-04-2012 at 04:47 PM.

+ 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