Hello,
I am trying to find a macro or a formula that will delete out interdependent dropdowns. I am a macro noob so thanks in advance for your patience.
Right now, I have a sheet that is set up using the indirect formula via data validation to allow the user to select various dropdowns. For example, if G30 is selected, then G32 will show the relevant dropdowns. This goes on for a number of rows (i.e., if G37 is selected, then G41 will show the relevant dropdowns, which will prompt G44, etc).
My issue is if any of the prior dropdowns are changed, the other related dropdowns stay static so that they are no longer valid. I saw on here that there was a way to do this via a macro to clear out related dropdowns but it is set up to do this when the dropdowns are next to each other. My excel is set up so that the dropdowns are stacked in the same column but different rows. Can someone help me modify the macro so that it works for drop-downs that are in the same column? Or is there a formula that will do the same thing?
For reference, the macro I found that does what I want (but is set up for cells in the same row) is:
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
I am trying to find a macro or a formula that will delete out interdependent dropdowns. I am a macro noob so thanks in advance for your patience.
Right now, I have a sheet that is set up using the indirect formula via data validation to allow the user to select various dropdowns. For example, if G30 is selected, then G32 will show the relevant dropdowns. This goes on for a number of rows (i.e., if G37 is selected, then G41 will show the relevant dropdowns, which will prompt G44, etc).
My issue is if any of the prior dropdowns are changed, the other related dropdowns stay static so that they are no longer valid. I saw on here that there was a way to do this via a macro to clear out related dropdowns but it is set up to do this when the dropdowns are next to each other. My excel is set up so that the dropdowns are stacked in the same column but different rows. Can someone help me modify the macro so that it works for drop-downs that are in the same column? Or is there a formula that will do the same thing?
For reference, the macro I found that does what I want (but is set up for cells in the same row) is:
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