使用VBA代码按日期过滤,过滤所需范围

时间:2015-09-15 08:05:57

标签: excel vba excel-vba

我有一个包含日期和内容的列表,需要按日期过滤它们。

我有这个代码

Private Sub CommandButton4_Click()

Dim dDate As Date
Dim strDate As String
Dim lDate As Long


dDate = DateSerial(2015, 9, 9)
lDate = dDate
Sheets("Einfügen_Auswertung").Range("A18").AutoFilter
Sheets("Einfügen_Auswertung").Range("A18").AutoFilter Field:=3, Criteria1:=">=" & lDate, _
Operator:=xlAnd, Criteria2:="<" & lDate + 1


End Sub

问题是我需要来自D4的DateSerial(2015, 9, 9)日期。有人能告诉我怎么样? .Range(“D4”)不起作用):

我不是程序员...... :) 招呼

0 个答案:

没有答案
相关问题