Hi, I have a table with parent dropdown lists in columns 18, 30 and 34. Each one has a dependent dropdown lists in the second column to the right of each (that is columns 20, 32 and 36).
I want each dependent list cell to clear whenever its parent list is change. I have therefore created this code below in the sheet code of my macro-enabled files but it does seem to work. Kindly help.
I want each dependent list cell to clear whenever its parent list is change. I have therefore created this code below in the sheet code of my macro-enabled files but it does seem to work. Kindly help.
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Column = 18 Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Target.Offset(0, 2).ClearContents
End If
End If
On Error Resume Next
If Target.Column = 30 Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Target.Offset(0, 2).ClearContents
End If
End If
On Error Resume Next
If Target.Column = 34 Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Target.Offset(0, 2).ClearContents
End If
End If
End Sub