自动过滤到今天的日期

时间:2013-08-11 13:28:31

标签: excel vba

我正在尝试按两列排序。现状和批准日期。批准的日期必须是当前日期。

当我尝试调试代码时,当我添加监视以查看分配的日期时,它显示例如2013年8月11日,这与我在电子表格中对某些单元格的内容相同满足当前的状态,但当它意味着将它们留在那里时它仍会过滤掉它们。有没有理由说这不起作用?

Dim w As Integer, b As Integer, rngData2 As Range
Set rngData2 = Range("A1").CurrentRegion
w = Application.WorksheetFunction.Match("Current State", Range("A1:AZ1"), 0)
b = Application.WorksheetFunction.Match("Approved Date", Range("A1:AZ1"), 0)

rngData2.AutoFilter Field:=w, Criteria1:=Array( _
"Approved", "Detailed Impact Assessment", "Draft – Yet to be Tabled at CCCM", _
"Initial Impact Assessment", "New", "On Hold", "Pending Approval - Execution", _
"Pending Approval - IIA"), Operator:=xlFilterValues

rngData2.AutoFilter Field:=b, Criteria1:=Array( _
Date, "TBC"), Operator:=xlFilterValues

0 个答案:

没有答案