+ Reply to Thread
Results 1 to 9 of 9

VBA Code to clear multiple dependent drop down lists

  1. #1
    Registered User
    Join Date
    06-21-2021
    Location
    West Midlands, England
    MS-Off Ver
    2010
    Posts
    4

    VBA Code to clear multiple dependent drop down lists

    Hi!

    A Couple of questions here about VBA codes -

    I have a form with multiple dependent drop down lists & require the cells containing these lists to clear each time the parent drop down is changed.

    I've managed to do this with 2 parent & dependent lists so far using the below code:

    Just to briefly explain;
    B16 is my first parent list with C16:G16 containing dependants which then clear when B16 is changed
    B18 is my 2nd parent list with C18:F18 & B20:G20 containing dependent lists or formulas which then clear when B18 is changed. My formulas have disappeared though so I'm guessing the below code has cleared them out?

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

    I then want my new parent drop down's C27:C42 to clear out D27:E42 - I'm just not sure how to get multiple codes in the sheet.

    It's been a very long time (about 14 years) since I last looked at macro's etc so I'm still quite new to this.

    If anyone could give some advice on the codes above & if I could be doing things a different way it would be much appreciated
    Last edited by Richard Buttrey; 06-23-2021 at 10:13 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Code to clear multiple dependent drop down lists

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.

    To upload a file click the Go Advanced button at the foot of your post, look underneath the post area for the Manage Attachments section and take it from there.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: VBA Code to clear multiple dependent drop down lists

    please see forum rules - place code between code tags - then we can help.
    upload your workbook - see big yellow banner - how to.
    At first glance the process looks 'painful', I am sure we can come up with something more suitable given more detail.
    torachan.

  4. #4
    Registered User
    Join Date
    06-21-2021
    Location
    West Midlands, England
    MS-Off Ver
    2010
    Posts
    4

    Re: VBA Code to clear multiple dependent drop down lists

    Will do - thanks

  5. #5
    Registered User
    Join Date
    06-21-2021
    Location
    West Midlands, England
    MS-Off Ver
    2010
    Posts
    4

    Re: VBA Code to clear multiple dependent drop down lists

    Workbook now attached

    Yellow highlighted cells are parent drop down lists
    Green highlighted cells are dependant drop down lists
    Ideally want the green to clear when each yellow parent is changed.
    Attached Files Attached Files

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: VBA Code to clear multiple dependent drop down lists

    please place your code in post #1 between code tags - we can then look at your problem.
    torachan.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Code to clear multiple dependent drop down lists

    Hi,

    You forgot to add the Code tags. Since you're new here I've added them for you but please note in the future.

    As to your request use a SheetChange event procedure like the one below for VBA Sheet2 code name

    Please Login or Register  to view this content.
    Adapt for other cells which need to zero others when they themselves are changed.

  8. #8
    Registered User
    Join Date
    06-15-2021
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    34

    Re: VBA Code to clear multiple dependent drop down lists

    Fixing my code

  9. #9
    Registered User
    Join Date
    06-21-2021
    Location
    West Midlands, England
    MS-Off Ver
    2010
    Posts
    4

    Re: VBA Code to clear multiple dependent drop down lists

    Thanks so much - I'll give this a go!

    Apologies for not posting properly...

+ 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. [SOLVED] Multiple dependent drop down lists
    By Ronald Reagan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-23-2020, 09:10 PM
  2. Replies: 4
    Last Post: 01-27-2020, 09:32 AM
  3. [SOLVED] Clear up to three dependent drop down lists based on selection in superior drop down list
    By theletterh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-04-2016, 09:31 PM
  4. [SOLVED] Help with multiple dependent drop down lists
    By NHamilton07 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-28-2014, 07:58 AM
  5. [SOLVED] The VBA code to auto-clear dependent drop down selection when parent cell change.
    By Hotgirl in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 07:48 PM
  6. [SOLVED] Clear Dependent Drop Down Lists
    By Ambassador777 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-03-2012, 11:38 PM
  7. Multiple Dependent Drop Down lists?
    By Steve in forum Excel General
    Replies: 0
    Last Post: 12-07-2005, 04:40 PM

Tags for this Thread

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