我正在尝试使用代码根据当前日期动态过滤电子表格。
我将需要过滤的日期存储为“CurrDay”,并试图将存储的日期重新调用到我的过滤算法中。它不起作用,我需要弄清楚如何完成此代码。每次我运行代码时,它都会返回过滤器中的 CurrDay 名称,而不是存储在 CurrDay 变量下的日期。
我在这里遗漏了一些东西,我需要一些指导。任何帮助表示赞赏。
代码:
Sub Finishing_A59_Filter()
'
' Finishing_A59_Filter Macro
' This macro will activate the A59 and Filter it properly for standard orders
'
'This macro does not include the VMI's and APS orders in the code
'
'
Dim Currday As Date
Currday = Date + 7
UName = Application.UserName
Workbooks.Open Filename:="G:\Copy Modified A59 5-19-2009.xlsm", UpdateLinks _
:=0
Range("M2").Select
ActiveCell.Value = Currday
Columns("Q:Q").Select
Selection.NumberFormat = "mm/d/yyyy"
' Filter the sheet to remove VMI's and APS orders
ActiveSheet.Range("$A$3:$AA$2941").AutoFilter Field:=23, Criteria1:=Array( _
"01", "04", "06", "08", "09", "10", "15", "25", "="), Operator:=xlFilterValues
' Set the proper date range for the sheet - This needs to be seven days beyond the current date
ActiveSheet.Range("$A$3:$AA$2941").AutoFilter Field:=17, Criteria1:= _
"<=Currday", Operator:=xlAnd