+ Reply to Thread
Results 1 to 4 of 4

Clear multiple dependant dropdown lists

Hybrid View

EveB1976 Clear multiple dependant... 01-06-2025, 11:23 AM
JohnTopley Re: Clear multiple dependant... 01-06-2025, 11:43 AM
EveB1976 Re: Clear multiple dependant... 01-10-2025, 07:33 AM
ByteMarks Re: Clear multiple dependant... 01-10-2025, 11:08 AM
  1. #1
    Registered User
    Join Date
    01-06-2025
    Location
    London
    MS-Off Ver
    18.2412.1162.0
    Posts
    4

    Question Clear multiple dependant dropdown lists

    Hi

    I am working on a spreadsheet excel that contains multiple dependent dropdown lists. I managed to find the VBA code that clears the contents of the second list if the first cell is changed...

    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    If Target.Column = 2 Then
    If Target.Validation.Type = 3 Then
    Application.EnableEvents = False
    Target.Offset(0, 1).ClearContents
    End If
    End If

    exitHandler:
    Application.EnableEvents = True
    Exit Sub

    End Sub

    This is working great for columns 2 and 3 of my spreadsheet,.

    However, I have another dependant dropdown list in columns 9 and 11, and I need to apply the same logic to these (column 11 reverts to blank if column 9 is amended).

    Please can someone help me? I've been searching the web for solutions all day and I'm getting nowhere!

    BTW - I have zero experience of VBA!!

    Thanks!
    Last edited by EveB1976; 01-06-2025 at 11:32 AM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,705

    Re: Clear multiple dependant dropdown lists

    Try

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    If Target.Column = 2 Then
        If Target.Validation.Type = 3 Then
            Application.EnableEvents = False
            Target.Offset(, 1).ClearContents
        End If
    Else
        If Target.Column = 9 Then
            If Target.Validation.Type = 3 Then
                Application.EnableEvents = False
                Target.Offset(0, 2).ClearContents
            End If
        End If
    End If
    
    exitHandler:
    Application.EnableEvents = True
    Exit Sub
    End Sub
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    01-06-2025
    Location
    London
    MS-Off Ver
    18.2412.1162.0
    Posts
    4

    Re: Clear multiple dependant dropdown lists

    This is so strange. It was working, but now it doesn't?!? I haven't changed anything. I am so confused.

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,966

    Re: Clear multiple dependant dropdown lists

    Maybe your events are disabled.

    In the VBA Editor, press Ctrl+G to open the Immediate Window.
    Delete anything in there, then type or paste application.EnableEvents =True and press enter

+ 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. Dependant dropdown lists
    By itchy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2021, 05:57 AM
  2. [SOLVED] Dependant Dropdown Lists not working
    By Oldsquid in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-26-2014, 09:45 AM
  3. Multiple Dependant Dropdown lists - need to show unique values only please
    By parsonsamie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-27-2014, 07:04 PM
  4. [SOLVED] Auto Clear Multiple Dependant Dropdown Lists
    By Nexial in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2014, 11:15 AM
  5. dependant 4 dropdown lists vba code. Help pls
    By Milan Bhatia in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-20-2013, 08:55 AM
  6. Dependant dropdown lists
    By Adamitus in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-21-2012, 12:36 PM
  7. Dependant Dropdown Lists or another way?
    By ArnyVee in forum Excel General
    Replies: 1
    Last Post: 03-05-2009, 05:18 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