|
供参考,和老师们还有很大差距,把上班时间汇总到分钟了。- Sub f()
- Dim crr()
- arr = Range("g4:ah" & 21).Value
- For i = 1 To UBound(arr)
- t = 0: s = 0
- For j = 1 To UBound(arr, 2)
- If arr(i, j) <> "" Then
- brr = Split(arr(i, j), Chr(10))
- k = UBound(brr)
- Select Case k
- Case Is = 1
- s = DateDiff("n", brr(0), brr(1))
- t = t + s
- Case Is = 2
- s = DateDiff("n", brr(0), brr(1))
- t = t + s
- Case Is = 3
- s = DateDiff("n", brr(0), brr(1)) + DateDiff("n", brr(2), brr(3))
- t = t + s
- Case Is = 4
- s = DateDiff("n", brr(0), brr(1)) + DateDiff("n", brr(2), brr(4))
- t = t + s
- End Select
- End If
- Next
- n = n + 1
- ReDim Preserve crr(1 To n)
- crr(n) = t
- Next
- [am4].Resize(n, 1) = WorksheetFunction.Transpose(crr)
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|