試圖在我已複製和cahnged一些vba我的手。篩選器不接受日期變量
這行之有效
With ActiveSheet
.AutoFilterMode = False
rng1.AutoFilter Field:=1, Criteria1:="<>2014-12-02"
rng1.Offset(1, 0).EntireRow.Delete
.AutoFilterMode = False
End With
我創建了一個名爲factorydate變量
factorydate = Worksheets("systemdata").Cells(3, "C").Value
如何更換日期 '2014年12月2日' 與變量factorydate?是這樣的:
With ActiveSheet
.AutoFilterMode = False
rng1.AutoFilter Field:=1, Criteria1:="<>" & factorydate
rng1.Offset(1, 0).EntireRow.Delete
.AutoFilterMode = False
End With
嘗試:'&DateValue(factorydate)' – 2014-12-03 14:46:44