我用VBA写了一个,你参考下吧。呵呵。效果:根据打开文件时的日期,提醒后7天的日程。
实现步骤:在【工程资源管理器】中的【thisworkbook】上双击,在弹出的代码框内写下代码:
Private Sub Workbook_open()
Dim x, i As Integer
Dim thedate As Date
Dim str As String
Dim str1 As String
xr = Cells(65535, 1).End(xlUp).Row
For i = 2 To xr Step 1
thedate = Cells(i, 1).Value
x = DateDiff("d", Now, thedate)
If x <= 7 Then str1 = Cells(i, 1) & ":" & Cells(i, 2) Else str1 = ""
str = str & Chr(10) & str1
Next
MsgBox "最近7天要做的事:" & str
End Sub