drew.j.harrison
Board Regular
- Joined
- Jul 9, 2010
- Messages
- 65
I am trying to get my list to sort based on the combined values of three check boxes. I created a line for each possible combination and for some reason it doesn't work properly. I think it has to do with my coding to get it to only perform an action if all three values are met. Here is the code, let me know if you see a problem:
If Range("AH2") = True And Range("AH3") = True And Range("AH4") = True Then
Selection.AutoFilter Field:=25 'Note : All
ElseIf Range("AH2") = False And Range("AH3") = True And Range("AH4") = True Then
Selection.AutoFilter Field:=25, Criteria1:="<>High" 'Note : Medium and Low
ElseIf Range("AH2") = False And Range("AH3") = False And Range("AH4") = True Then
Selection.AutoFilter Field:=25, Criteria1:="<>High", Operator:=xlAnd, _
Criteria2:="<>Medium" 'Note : Low only
ElseIf Range("AH2") = False And Range("AH3") = False And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="=" 'Note: None Selected
ElseIf Range("AH2") = True And Range("AH3") = False And Range("AH4") = True Then
Selection.AutoFilter Field:=25, Criteria1:="<>Medium" 'Note : High and Low
ElseIf Range("AH2") = True And Range("AH3") = False And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="<>Medium", Operator:=xlAnd, _
Criteria2:="<>Low" 'Note : High only
ElseIf Range("AH2") = Trues And Range("AH3") = True And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="<>Low" 'Note : High and Medium
ElseIf Range("AH2") = False And Range("AH3") = True And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="<>High", Operator:=xlAnd, _
Criteria2:="<>Low" 'Note : Medium only
If Range("AH2") = True And Range("AH3") = True And Range("AH4") = True Then
Selection.AutoFilter Field:=25 'Note : All
ElseIf Range("AH2") = False And Range("AH3") = True And Range("AH4") = True Then
Selection.AutoFilter Field:=25, Criteria1:="<>High" 'Note : Medium and Low
ElseIf Range("AH2") = False And Range("AH3") = False And Range("AH4") = True Then
Selection.AutoFilter Field:=25, Criteria1:="<>High", Operator:=xlAnd, _
Criteria2:="<>Medium" 'Note : Low only
ElseIf Range("AH2") = False And Range("AH3") = False And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="=" 'Note: None Selected
ElseIf Range("AH2") = True And Range("AH3") = False And Range("AH4") = True Then
Selection.AutoFilter Field:=25, Criteria1:="<>Medium" 'Note : High and Low
ElseIf Range("AH2") = True And Range("AH3") = False And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="<>Medium", Operator:=xlAnd, _
Criteria2:="<>Low" 'Note : High only
ElseIf Range("AH2") = Trues And Range("AH3") = True And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="<>Low" 'Note : High and Medium
ElseIf Range("AH2") = False And Range("AH3") = True And Range("AH4") = False Then
Selection.AutoFilter Field:=25, Criteria1:="<>High", Operator:=xlAnd, _
Criteria2:="<>Low" 'Note : Medium only