目标:当我在特定的cel中选择Date(" G1")时,该表应该过滤给定日期的数据。
到目前为止我做了什么:
Dim Topic As String
Dim finalrow As Integer
Dim i As Integer 'row counter
Dim C As Range, rng
Dim Test1 As String 'give the output by combining all the article topics
Dim selectdate As Date
Sheets("Raw").Range("H2:I23").ClearContents
设置selectdate =表格("表格1")。范围(" G1")
Set rng = Sheets("Sheet1").Range("A2:E50")
'filtering data as per today's date
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$E$23").AutoFilter Field:=1, Operator:= _
xlFilterValues, Criteria2:=Array(2, "12/16/2015")
For Each C In rng
Test1 = Test1 & C.Value
Next C
Range("H2") = Test1
但这只是过滤掉了具体的日期。而不是我在" selectdate"中引用的日期。我在这里遗漏了一些东西,但不确定是什么。
另外,请参阅下面我想要实现的内容的屏幕截图:
答案 0 :(得分:1)
ActiveSheet.Range("$A$1:$E$23").AutoFilter Field:=1, Operator:= _
xlFilterValues, Criteria2:=Array(2, SelectDate)