littleclayjar
Technical User
When a value on a dropdown box is selected, it goes to the three worksheets and filters by that value. However, I keep getting this error "Autofilter method of range failed error" when it gets to the second criteria that filters by field:=4 (see bolded). Am I not deselecting something when I'm supposed to? Thanks for any help you can provide!
' Manager_Filter Macro
'
'
If Worksheets("Instructions").Cells(7, 7).Value = "Enoiu" Then
Worksheets("1a. MOS_US").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Enoiu"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("1b. MOS_UK").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Enoiu"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("2. JS_ALL").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:R1").AutoFilter Field:=8, Criteria1:="Enoiu"
Range("A1:R1").AutoFilter Field:=5, Criteria1:="<>" & 0
ElseIf Worksheets("Instructions").Cells(7, 7).Value = "Zhou" Then
Worksheets("1a. MOS_US").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Zhou"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("1b. MOS_UK").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Zhou"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("2. JS_ALL").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:R1").AutoFilter Field:=8, Criteria1:="Zhou"
Range("A1:R1").AutoFilter Field:=5, Criteria1:="<>" & 0
End If
Worksheets("Instructions").Select
End Sub
' Manager_Filter Macro
'
'
If Worksheets("Instructions").Cells(7, 7).Value = "Enoiu" Then
Worksheets("1a. MOS_US").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Enoiu"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("1b. MOS_UK").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Enoiu"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("2. JS_ALL").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:R1").AutoFilter Field:=8, Criteria1:="Enoiu"
Range("A1:R1").AutoFilter Field:=5, Criteria1:="<>" & 0
ElseIf Worksheets("Instructions").Cells(7, 7).Value = "Zhou" Then
Worksheets("1a. MOS_US").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Zhou"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("1b. MOS_UK").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:AB1").AutoFilter Field:=6, Criteria1:="Zhou"
Range("A1:AB1").AutoFilter Field:=4, Criteria1:="<>" & 0
Worksheets("2. JS_ALL").Select
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Range("A1:R1").AutoFilter Field:=8, Criteria1:="Zhou"
Range("A1:R1").AutoFilter Field:=5, Criteria1:="<>" & 0
End If
Worksheets("Instructions").Select
End Sub