skull_eagle
Board Regular
- Joined
- Mar 25, 2011
- Messages
- 89
I'm running the attached code, it is applying the correct filter on the correct column but the results displayed are incorrect.
When I manually apply the same filter, the correct results are displayed.
This is very strange and I don't understand why this is happening.
Any help would be greatly appreciated.
Thank you
When I manually apply the same filter, the correct results are displayed.
This is very strange and I don't understand why this is happening.
Any help would be greatly appreciated.
Thank you
VBA Code:
DateVal = Worksheets("Admin").Range("P6")
If ColNum2 = 99 Then
If Search_Form.Controls("CM_" & ColNum2) = "< 35" Then
ActiveSheet.ListObjects("Table_RawData").Range.AutoFilter Field:=6, _
Criteria1:="<" & DateVal, Operator:=xlAnd
ElseIf Search_Form.Controls("CM_" & ColNum2) = "> 35" Then
ActiveSheet.ListObjects("Table_RawData").Range.AutoFilter Field:=6, _
Criteria1:=">" & DateVal, Operator:=xlAnd
ElseIf Search_Form.Controls("CM_" & ColNum2) = "CLEAR" Then
ActiveSheet.ListObjects("Table_RawData").Range.AutoFilter Field:=6
End If
End If