|
- Option Explicit
- Sub yusa()
- Dim A
- Dim B As Integer
- Dim C As Variant
- Dim D As String
- With Sheets("信息录入")
- B = Application.CountA(Range("T:T")) + 3
- C = Val(Format(Format(Now, "YYYY/MM/DD"), "0"))
- If B > 4 Then
- A = .Range("A5:T" & B)
- For B = 1 To UBound(A)
- If A(B, 2) <> "" Then
- If Val(Format(A(B, 20), "0")) > C Then
- If Val(Format(A(B, 20), "0")) - C <= 40 Then
- D = D & "工号:" & A(B, 4) & "合同即将到期!" & Chr(10)
- End If
- End If
- End If
- Next
- If D <> "" Then MsgBox D, 64
- Else
- MsgBox "当前工作表中无数据!", 16
- End If
- End With
- End Sub
复制代码- Option Explicit
- Private Sub Workbook_Open()
- Call yusa
- End Sub
复制代码
|
|