Consulting

Results 1 to 2 of 2

Thread: VBA dependent drop down list

  1. #1

    VBA dependent drop down list

    Hi,

    I have looked over different forums and actually tried this but didnt work.

    I want my dependent drop down list to clear when parent cell changes( which is not a dropdown)
    The thing is that in the parent cell there is a formula which is somehow dependent on a certain criteria.

    I have inserted this code below, which apparently works if i change the parent cell manualy, but when the parent cell changes based on the criteria the dependent drop down does not react to this.

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


    exitHandler:
    Application.EnableEvents = True
    Exit Sub


    End Sub


    Could somebody help me sort this out?

    Thank you

  2. #2
    VBAX Regular
    Joined
    Jul 2018
    Posts
    17
    Location
    In a rush, so apologies for the terse answer !

    The reason it isn't working as you expect is that the non-manual changes don't trigger the Worksheet Change Event

    Look for another way to force it to run, or for a different Event to use.

    PS I didn't see the Application.EnableEvents = False statement at the beginnning of the code ? You must always include this in Change Event code or you risk infinite loops !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •