Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to clear dependent drop down list cell after selecting changed in Excel?

For a dependent drop down list, when the value of the parent drop down list is changed, the selected value in the second one will be invalid. You have to manually remove the invalid value from the second drop down list after selecting changed in the first one. In this article, I will show you a method to automatically clear the dependent drop down list cell after selecting changed in Excel.

Clear dependent drop down list cell after selecting changed with VBA code


Clear dependent drop down list cell after selecting changed with VBA code


The following VBA code helps you to clear dependent drop down list after selecting changed in Excel.

1. Right click the sheet tab contains the dependent drop down list you will clear automatically, then select View Code from the context menu.

2. In the opening Microsoft Visual Basic for Applications window, copy below VBA code into the window.

VBA code: clear dependent drop down list cell after selecting changed

Private Sub Worksheet_Change(ByVal Target As Range)
'Update by Extendoffice 2018/06/04
    Application.EnableEvents = False
    If Target.Column = 5 And Target.Validation.Type = 3 Then
        Target.Offset(0, 1).Value = ""
    End If
    Application.EnableEvents = True
End Sub

Note: In the code, number 5 is the column number contains the parent drop down list. In this case, my parent drop down list locates in column E.

3. Press the Alt + Q keys to close the Microsoft Visual Basic for Applications window.

From now on, when changes made to the parent drop down list, contents of the second drop down list will be cleared automatically. See screenshot:


Related articles:



Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 300 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    امید کیا · 3 months ago
    سلام وقت شما بخیر
    ما فایل اکسلی داریم که خروجیش از طریق نرم افزار همکاران سیستم هست یعنی فایل اکسل ما آنلاین به data base نرم افزار همکاران متصله(این مهم نیست برای اطلاع عرض کردم) توی این فایل فیلترهایی وجود داره که هر فیلتر یک لیست کشویی داره مشکل ما اینه که وقتی میخواهیم هر کدوم از فیلتر ها یکی از موارد لیست کشویی رو انتخاب کنیم با انتخاب لیست،لیست کشویی زود می پره یعنی بسته میشه زود و نمیشه چیزی رو انتخاب کرد،اینم بگم خدمتتون که آفیس رو حذف و نصب هم کردم بازم جواب نداد یعنی یه مدت خیلی کوتاهی جواب میده بعد به حالت قبل بر میگرده با پشتیبانی همکاران هم تماس گرفتیم گفتن مشکل از آفیستونه
    (آفیسمون 2016 هست)یعنی عملا اونها هم نتونستن مشکل رو پیدا کنن.
    لطفا اگه راهی هست ممنون میشم راهنماییم کنید.
    با تشکر