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

or
0
0
0
s2smodern

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

btn read more      btn download     btn purchase

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.

Be the first to comment.