I have create the following Code in a worksheet (automatically runs when data is entered into B4) that works with two issues. I want to add a third IF statement and I get a runtime error when I enter information in another cell other than in "B4". the two "Calls" are for filtering a list based on what is selected from a data validation list in "B4".
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
Set r = Intersect(Target, Range("B4"))
Application.EnableEvents = False
If r = "All Services" Then
Call Test3
Else
Call Test2
End If
Application.EnableEvents = True
End Sub
Again, just want to add a third if with another call and be able to enter data in other cells without a runtime error.
THANKS!
BTW, My Calls
Sub Test2()
Dim C As Range
Set C = Range("B4")
ActiveSheet.Range("$B$5:$B$1000").AutoFilter Field:=1, Criteria1:=C.Value
End Sub
Sub Test3()
Selection.AutoFilter
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
Set r = Intersect(Target, Range("B4"))
Application.EnableEvents = False
If r = "All Services" Then
Call Test3
Else
Call Test2
End If
Application.EnableEvents = True
End Sub
Again, just want to add a third if with another call and be able to enter data in other cells without a runtime error.
THANKS!
BTW, My Calls
Sub Test2()
Dim C As Range
Set C = Range("B4")
ActiveSheet.Range("$B$5:$B$1000").AutoFilter Field:=1, Criteria1:=C.Value
End Sub
Sub Test3()
Selection.AutoFilter
End Sub
Last edited: