'############################################################### '函数作用:计算日期差,除去星期六、星期日 '############################################################### Function daydif(x As Range, y As Range) Dim date1, date2 As Date date1 = x date2 = y dif = 0 Do If (date1 >= date2) Then Exit Do End If date1 = date1 + 1 t1 = Weekday(date1) If (t1 < 7 And t1 > 1) Then dif = dif + 1 End If Loop daydif = dif End Function |
|