Closed Thread
Results 1 to 13 of 13

Auto-clear dependent dropdown when parent cell is changed

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Auto-clear dependent dropdown when parent cell is changed

    Hello!

    I have created some dependent drop downs that only give certain options when an item from the first column is selected. I'm wondering if there is a way to auto-clear the subsequent columns if the first column is changed? I have looked around a bit and have seen some VBA code stuff, but I'm an inexperienced user so it is all greek to me. Is there a way to do this with a formula within a cell?

    I've attached a sample. Please don't laugh at my crude attempts!

    Thanks and I hope to hear from you soon!

    Kim
    Attached Files Attached Files
    Last edited by Ceekimmy; 08-13-2012 at 11:58 AM. Reason: Solved

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Auto-clear dependent dropdown when parent cell is changed

    The only way is with VBA. It's not difficult if that is what you want to do. If what column (s) are changed, do you want the values (in which columns) cleared?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    08-10-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Auto-clear dependent dropdown when parent cell is changed

    Hi ChemistB,

    Thanks for getting back to me so quickly.

    If the column KEEP THIS TYPE OR CHANGE (H68 for example) is changed, I would like to clear the value in ORDER THIS TYPE OF HOLDER (I68).

    If the column CURRENT PINPAD HOLDER TYPE (G68) is changed, I would like to clear both H68 and I68.

    I have no experience with VBA, so I wouldn't even know where to start.

    Thanks again!

    Kim

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Auto-clear dependent dropdown when parent cell is changed

    Hi Kim,
    I did it in the attachment but here's how you do it. You want an Event driven macro (in this case, one that runs when you change something in G or H). This code would go in the worksheet module that you are using (in your example, sheet1). Right click on the sheet tab and "View Code" That opens the VBA editor. Paste this code in the text window (the code window)
    Please Login or Register  to view this content.
    You'll need to modify the ranges if your spreadsheet is different. If you insert rows, unlike formulas, these will not auto adjust so you'll need to fix them.
    Save the workbook with xlsm extention instead of xlsx.
    You will need to "enable content" when you open this file.
    Does this work for you?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-10-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Auto-clear dependent dropdown when parent cell is changed

    Like a charm! That's fantastic.

    Thank you so much for your help.

    k

  6. #6
    Registered User
    Join Date
    08-10-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Auto-clear dependent dropdown when parent cell is changed

    Sorry I've realized I should have started a new post rather than replying to this one...
    Last edited by Ceekimmy; 11-16-2012 at 02:13 PM. Reason: Started a new post

  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: Auto-clear dependent dropdown when parent cell is changed

    FYI, as an alternative to VBA, you could "fake it" with some conditional formatting. You could have the child cells turn their font to invisible colors when the value in that cell no longer matches a value from the selection in a parent cell.

    Sometimes the change in the parent cell changes to a list that DOES still have the value in the child cell, so maybe that would be good to leave alone and visible. This method would do that, only hiding the values selected that are no longer accurate options.

    Something to consider.
    _________________
    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!)

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Auto-clear dependent dropdown when parent cell is changed

    Okay, if you are going to have formulas in Column I, don't ever need that cleared. The code changes to
    Please Login or Register  to view this content.
    Does that work for you?

  9. #9
    Registered User
    Join Date
    08-10-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Auto-clear dependent dropdown when parent cell is changed

    ChemistB to the rescue!

    Perfectly. Thank you.

  10. #10
    Registered User
    Join Date
    09-26-2015
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    1

    Re: Auto-clear dependent dropdown when parent cell is changed

    This was exactly what I was looking for. The difference being that I have 4 columns of dependent choices started from a master column. I added the code for the additional columns and it works beautifully.

    Thank you.

  11. #11
    Registered User
    Join Date
    04-30-2019
    Location
    Houston, Texas
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    1

    Re: Auto-clear dependent dropdown when parent cell is changed

    Hello JBeaucaire,

    I would be interested in the solution you suggested, could you show me how to set up the conditional formatting to have the child cell turn the font color to white when the value in that cell no longer matches a value from the selection in the parent cell?

  12. #12
    Registered User
    Join Date
    10-03-2023
    Location
    MALAYSIA
    MS-Off Ver
    MS Office 2021
    Posts
    1

    Re: Auto-clear dependent dropdown when parent cell is changed

    hi sir, how you make the dropdown list like that?? i mean the dropdown list change base on the column g.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Auto-clear dependent dropdown when parent cell is changed

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed 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