aloy78
10-26-2011, 08:36 PM
Hi all,
I'm trying to get this code to work but some how it just doesn't connnect. I want to filter off records that consists of 3 criterias as follows:
1. Date Value of this month(xlFilterThisMonth)
2. and the next (xlFilterNextMonth)
3. text value which is equal to "tba"
' Code pasted in the sheet itself
If Target.Address = "$E$8" Then
Call Filter_Current_Month()
End If
' Code pasted in the Module
Sub Filter_Current_Month()
Dim awb As Workbook
Dim wsIAir As Worksheet
Set awb = ThisWorkbook
Set wsIAir = Worksheets("Imp-Air")
With wsIAir
.Range("A:ZZ").EntireColumn.Hidden = False ' show all hidden column from master sheet
.AutoFilterMode = False
.Range("B18:BE18").AutoFilter
.Range("B18:BE18").AutoFilter Field:=20, Criteria1:=xlFilterThisMonth, _
Operator:=xlAnd, Criteria2:="tba", _
Operator:=xlAnd, Criteria3:=xlFilterNextMonth
End With
Application.Calculate
End Sub
I'm trying to get this code to work but some how it just doesn't connnect. I want to filter off records that consists of 3 criterias as follows:
1. Date Value of this month(xlFilterThisMonth)
2. and the next (xlFilterNextMonth)
3. text value which is equal to "tba"
' Code pasted in the sheet itself
If Target.Address = "$E$8" Then
Call Filter_Current_Month()
End If
' Code pasted in the Module
Sub Filter_Current_Month()
Dim awb As Workbook
Dim wsIAir As Worksheet
Set awb = ThisWorkbook
Set wsIAir = Worksheets("Imp-Air")
With wsIAir
.Range("A:ZZ").EntireColumn.Hidden = False ' show all hidden column from master sheet
.AutoFilterMode = False
.Range("B18:BE18").AutoFilter
.Range("B18:BE18").AutoFilter Field:=20, Criteria1:=xlFilterThisMonth, _
Operator:=xlAnd, Criteria2:="tba", _
Operator:=xlAnd, Criteria3:=xlFilterNextMonth
End With
Application.Calculate
End Sub