drphilbill
New Member
- Joined
- Nov 18, 2015
- Messages
- 1
I'm using the following code to clear different lists in different cells:
However, all of them work except for If Target = Range("T5")... which clears all the data validation lists instead of just T6 and T9.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target = Range("T4") Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Range("T5").ClearContents
Range("T6").ClearContents
Range("T9").ClearContents
End If
End If
If Target = Range("T5") Then
If Target.Validation.Type = 3 Then
ApplicationEnableEvents = False
Range("T6").ClearContents
Range("T9").ClearContents
End If
End If
If Target = Range("T9") Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Range("T4").ClearContents
Range("T5").ClearContents
Range("T6").ClearContents
End If
End If
If Target = Range("T8") Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Range("T9").ClearContents
End If
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
End Sub
However, all of them work except for If Target = Range("T5")... which clears all the data validation lists instead of just T6 and T9.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target = Range("T4") Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Range("T5").ClearContents
Range("T6").ClearContents
Range("T9").ClearContents
End If
End If
If Target = Range("T5") Then
If Target.Validation.Type = 3 Then
ApplicationEnableEvents = False
Range("T6").ClearContents
Range("T9").ClearContents
End If
End If
If Target = Range("T9") Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Range("T4").ClearContents
Range("T5").ClearContents
Range("T6").ClearContents
End If
End If
If Target = Range("T8") Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Range("T9").ClearContents
End If
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
End Sub