信息科科室安全检查记录表(vba插入工作日记录)

时间:2023-06-23 12:41:52
【文件属性】:

文件名称:信息科科室安全检查记录表(vba插入工作日记录)

文件大小:51KB

文件格式:XLS

更新时间:2023-06-23 12:41:52

信息科科室安全检查记录表 安全检查记录表 科室安全检查记录表 安全检查记录

代码很简单,需要启用宏,具体代码如下: Sub Workbook_Open() Range("A3:F25").ClearContents a = 3 monthDays = Day(DateSerial(Year(Date), Month(Date) + 1, 0)) For i = 1 To monthDays date1 = Year(Now()) & "-" & Month(Now()) & "-" & i If workDay(date1) = "○" Then Range("A" & a).Value = date1 Range("B" & a).Value = "李四" Range("C" & a).Value = "同前页" Range("D" & a).Value = "无异常" a = a + 1 End If Next End Sub '判断指定日期是否上班 Function workDay(rq) Dim cel As Range If Weekday(rq) = 1 Or Weekday(rq) = 7 Then temp = "休" For Each cel In Range("节假日表!B2:B17") a = DateDiff("d", cel.Value, rq) If a = 0 Then temp = "○" Exit For End If Next Else temp = "○" For Each cel In Range("节假日表!A2:A37") a = DateDiff("d", cel.Value, rq) If a = 0 Then temp = "休" Exit For End If Next End If workDay = temp End Function


网友评论