+ Reply to Thread
Results 1 to 10 of 10

Create Default for Dependent Drop Down List

  1. #1
    Registered User
    Join Date
    02-18-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    4

    Create Default for Dependent Drop Down List

    Hi,
    I'm using dependent drop-down lists. In the first box the user can choose a color which drives a set of options in the second box. (e.g. User selects "Red" and in the second dropdown they can then choose "Red A", "Red B", "Red C", etc.). Right now, if you select "Orange", it will still show "Red A" from the previous selection until the user selects the dropdown in the dependent box to refresh the list of options. Is there a way to make it so that second dropdown box will default to "Orange A"?

    I tried writing some code to do this, but I can't seem to make it work. I've attached my file.

    Thanks!!!!
    Attached Files Attached Files
    Last edited by moskealy; 02-18-2010 at 05:05 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Create Default for Dependent Drop Down List

    Googling... i found this thread:

    http://www.keyongtech.com/5297423-ho...alidation-cell

    you can use T. Valko's event macro or Link to Debra Dalgleish's site and use her non-macro workaround.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    02-18-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Create Default for Dependent Drop Down List

    Thanks, but I'm hoping not to blank out the contents. What I'd like to do is the following:

    If the dropdowns start as
    Color: Red
    Type: RedA

    When you switch to Color: Orange, it should change Type to the first of the Orange list which is OrangeA. As it stands now, the Type stays the same so you see Color: Red and Type: OrangeA which is an invalid option.

    I tried writing code but it doesn't seem to be working right.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create Default for Dependent Drop Down List

    I've run into this issue. If you download a sample file from here:
    Jerry Beaucaire's Excel Tools
    The file you want is: --DependentLists3.xls - 3 levels

    There's a macro active on the CHOICES sheet (right-click the sheet tab and VIEW CODE) and you'll see it. It watches for changes to earlier parent lists causing the dependent lists to clear the now-invalid choices.

    You should be able to adapt that to actually insert a default value.


    Here's a thread where I helped someone do the default value thing:
    http://www.excelforum.com/excel-gene...ult-value.html
    Last edited by JBeaucaire; 02-18-2010 at 04:17 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Create Default for Dependent Drop Down List

    This one seems to do it:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-18-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Create Default for Dependent Drop Down List

    This works great! Thanks! Now the only issue is that when I try to change the dependent drop-down from Red A to Red B, it just keeps going back to Red A.



    Quote Originally Posted by NBVC View Post
    This one seems to do it:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create Default for Dependent Drop Down List

    Maybe this:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-18-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Create Default for Dependent Drop Down List

    That's it! Thanks so much!

    Quote Originally Posted by JBeaucaire View Post
    Maybe this:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-14-2010
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Create Default for Dependent Drop Down List

    The code used in this thread was a great find. Thanks JBeaucaire. I'm hoping for some additional assistance. I have a dependent drop down list in more than one column and don't know how to add an Or statement or If statement to duplicate what is occuring in the target column. Below is my code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub

    If Target.Address = "$B$11" Then
    Application.EnableEvents = False
    Range("B17").Value = "<Select>"
    Application.EnableEvents = True
    End If

    End Sub

    If I also want to duplicate this in cells D11 & D17, F11 & F17, etc., how would I do that?

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Create Default for Dependent Drop Down List

    Welcome to the forum,

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ 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