如何从今天的海量数据中search一天

Sub Macro1() Dim cell As Range Dim MyDay As Integer, MyYear As Integer, MyMonth As Integer Dim MyDate As Date MyDate = Format(MyYear & "/" & MyMonth & "/" & MyDay, "dd/mm/yyyy") < --Error Selection.Formula = "" Range("M1").Select Sheets("Case Settled in 2012").Select Cells.Find(What:=MyDate, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate MsgBox MyDay End Sub 

我想search数据date=today

MyDate =格式(MyYear&“/”&MyMonth&“/”&MyDay,“dd / mm / yyyy”)< – 错误

你需要的是DateSerial

 MyDate = DateSerial(MyYear, MyMonth, MyDay) 

你也需要初始化这些variables。

编辑:

我想search数据date=今天

关于你的第二个问题,@Mehow已经向你展示了如何遍历一个范围来在你的其他问题上做一个date比较。 在这里做一个类似的比较,并检查date是否匹配。