當前位置:編程學習大全網 - 編程軟體 - excel2007 vba 自動提醒

excel2007 vba 自動提醒

我用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

  • 上一篇:中專學歷可以考ocp嗎
  • 下一篇:IT培訓班學什麽?
  • copyright 2024編程學習大全網