关于在工作簿中search特定date并在那天之前设置预先通知?

有很多数据的工作簿,H列是date

我想通过点击一个button进行search,系统根据“今天”自动search,并select“一个月后”,例如现在是2013年11月26日,点击button,系统将selectdate12/26/2013和泵信息。

这里是我的代码,我只是想今天“存储”到一个variables,并开始search

Sub Macro1() ' Dim oldDate As Date Dim oldDay As Integer ' Assign a date using standard short format. oldDate = 2 / 12 / 1969 oldDay = Microsoft.VisualBasic.DateAndTime.Day(oldDate) ' oldDay now contains 12. Selection.Formula = "" Range("H1").Select Sheets("Pipeline").Select Cells.Find(What:=oldDay, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate End Sub 

系统表示该对象错过了。

请帮忙

我不知道这是你想要的,但尝试一下

 Sub Main() Dim cell As Range For Each cell In Range("H1:H" & Range("H" & Rows.Count).End(xlUp).Row) If cell = DateAdd("m", 1, Left(Now, 10)) Then MsgBox "Cell matches 1 month from today at " & cell.Address End If Next End Sub