Resetting Dependent Dropdown Lists

Elmaln

New Member
Joined
Jan 20, 2014
Messages
2
I realize that this question has been asked and answered previously - however, for the life of me I cannot figure out why the below code isn't working in my case.

My parent drop down list exists in column D (various rows) and my dependent list exists in column F (again various rows corresponding to those in D).

I have tried the following code, however, changes in cells column D (4) do not result in the contents of the corresponding cells in column F (6) being cleared. I have tried saving the excel workbook as binary and macro-enabled to no avail (if it even makes a difference).. what could I be doing wrong? Thanks.

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


exitHandler:
Application.EnableEvents = True
Exit Sub


End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I tested code below - it works for me and clears column F when olumn D changes
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
        If Target.Column = 4 Then
            If Target.Validation.Type = 3 Then
                Application.EnableEvents = False
                Target.Offset(0, 2).ClearContents
            End If
        End If
exitHandler:
Application.EnableEvents = True
End Sub


Is EnableEvents switched off inadvertently - I always have this macro available on a shortcut especially when testing
Code:
Sub ReEnable()
    Application.EnableEvents = True
End Sub

Exit Sub is pointless above End Sub with no code between the 2 lines (my code above excludes it)
- have you posted the whole of your code?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top