+ Reply to Thread
Results 1 to 13 of 13

Clearing Cells when changing dropdown list choice

  1. #1
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Clearing Cells when changing dropdown list choice

    Hi,

    Can someone point me in the right direction of this please?

    I've got four drop down lists which each populate dependent on the option chosen in the one below. The problem is once populated, if you go back to the previous box and change the option you pick, the next box keeps continues to display the option picked previously which technically should no longer exist.

    How do i get the menu in question to clear when the box prior has a new option chosen?

    thanks

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Clearing Cells when changing dropdown list choice

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Ben Van Johnson

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Clearing Cells when changing dropdown list choice

    As far as I know, there is no regular formula that will "zero out" the other cells, but you could perhaps use Conditional Formatting to change the cell color if its contents doesnt match what it should?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Clearing Cells when changing dropdown list choice

    Hi,

    Thanks for the replies - i hope there is an answer to this as it just looks unfinished without it

    The example is attached. As you will see, if you pick 1 from the list in box 1, then A in box 2, it allows you to pick a1 from box 3.

    problem is if you then go back to box 2 and change your pick to B, box 3 remains as a1 but that should no longer be an option. How do you get then to clear?
    Attached Files Attached Files

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Clearing Cells when changing dropdown list choice

    This will change teh cell color (to your choise)...

    1. highlight the range you want to apply the conditional formatting to (F6:F7)
    2. on the home tab, styles, select CF
    3. select new rule, select use formula
    4. enter =ISERROR(MATCH(F6,INDIRECT(F5),0)) format fill RED (or whatever you want)

    You could then include an instruction to check for RED

  6. #6
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Clearing Cells when changing dropdown list choice

    Thanks FDibbins.

    Not quite the solution I'm looking for but will be my default position shortly if an auto clear cannot be found.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Clearing Cells when changing dropdown list choice

    I know this can be done with VBA, but not with a regular formula. If you put a formula in teh DD cell, it will be replaces the very 1st time you use the DD

  8. #8
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Clearing Cells when changing dropdown list choice

    i should really learn VBA at some point...

  9. #9
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Clearing Cells when changing dropdown list choice

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Clearing Cells when changing dropdown list choice

    Hi ProtonLeah,

    Thanks a great piece of code and works fantastically in my example.

    My main workbook though is trying to do the same thing with 4 option boxes: E4, E6, E8 & E10 so i changed it to below and it's not work apart from E4 changes E6 - all the rest don't do anything. Have i missed something?:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Select Case Target.Address
    Case Is = "$E$4"
    Target.Offset(2, 0).Resize(5, 1).Value = ""
    Case Is = "$E$6"
    Target.Offset(2, 0).Resize(3, 1).Value = ""
    Case Is = "$E$8"
    Target.Offset(2, 0).Value = ""
    End Select
    End Sub

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Clearing Cells when changing dropdown list choice

    Just a passing observation...

    This "side effect" is almost always overlooked when folks ask for dependent drop down lists!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  12. #12
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Clearing Cells when changing dropdown list choice

    Quote Originally Posted by Tony Valko View Post
    Just a passing observation...

    This "side effect" is almost always overlooked when folks ask for dependent drop down lists!
    it drive me nuts! does my OCD no good at all...

  13. #13
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Clearing Cells when changing dropdown list choice

    Ignore me. It's now working fine. My computer must have been having a moment. Thanks protonleah

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Return data depending on dropdown list choice
    By GenericPat in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-05-2012, 02:42 PM
  2. Autocomplete cell from choice on dropdown list
    By mc515 in forum Excel General
    Replies: 3
    Last Post: 10-23-2008, 10:05 AM
  3. Creating dropdown list clearing blank fields
    By pauloreiss in forum Excel General
    Replies: 1
    Last Post: 06-17-2008, 03:29 PM
  4. [SOLVED] Dropdown list/Multiple choice??
    By KDD in forum Excel General
    Replies: 2
    Last Post: 08-30-2005, 05:05 AM

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