Sub CheckDueDate() Dim row As Long Dim dueDate As Date Dim currentDate As Date

currentDate = Date

For row = 2 To ActiveSheet.Cells(Rows.Count, 1).End(xlUp).row
    dueDate = Cells(row, 3).Value
    
    If dueDate < currentDate Then
        MsgBox "项目 " & Cells(row, 1).Value & " 已过期,请尽快处理!", vbExclamation, "到期提醒"
    End If
Next row

End Sub

这是一个简单的宏,可以用于检查表格中到期日期是否过期,并在过期时弹出提醒窗口。该宏假设到期日期存储在第三列,并且第一行是标题行。在使用前,请确保正确设置日期格式并保存表格。您可以将此宏绑定到一个按钮,以便轻松运行检查。

excel表格到期弹窗提醒宏

原文地址: http://www.cveoy.top/t/topic/KXo 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录