- Sub g()
- Dim arr, brr(1 To 66666, 1 To 5)
- arr = [a1].CurrentRegion
- For i = 2 To UBound(arr)
- x = Hour(arr(i, 2))
- y = Hour(arr(i, 3))
- jj = y - x
- If jj = 0 Then
- k = k + 1
- brr(k, 1) = arr(i, 1)
- brr(k, 2) = arr(i, 2)
- brr(k, 3) = arr(i, 3)
- brr(k, 4) = Minute(brr(k, 3) - brr(k, 2))
- brr(k, 5) = arr(i, 4)
- Else
- jj = IIf(jj = 1, 2, IIf(jj > 1, jj, y - x + 25))
- For j = 1 To jj
- k = k + 1
- brr(k, 1) = arr(i, 1)
- brr(k, 2) = IIf(j = 1, arr(i, 2), TimeSerial(x + j - 1, 0, 0))
- brr(k, 3) = IIf(j = jj, arr(i, 3), TimeSerial(x + j, 0, 0))
- brr(k, 4) = IIf(j = 1, Minute(brr(k, 3) - brr(k, 2)), IIf(j = jj, Minute(brr(k, 3) - brr(k, 2)), 60))
- brr(k, 5) = arr(i, 4)
- Next
- End If
- Next
- [g2:k66666] = ""
- [g2].Resize(k, 5) = brr
- End Sub
复制代码 |