|
|
- Sub ykcbf() '//2025.12.10
- arr = [a3:ae3].Value
- ReDim brr(1 To 1, 1 To UBound(arr, 2))
- For j = 1 To UBound(arr, 2)
- If arr(1, j) <> "" Then
- xm = arr(1, j)
- brr(1, j) = ston(xm)
- End If
- Next
- [a7:ae7].Value = brr
- End Sub
- Function ston(inputStr) As String
- Dim timeList As New Collection
- Dim i As Integer
- Dim currentTime As String
- Dim prevTime As Date
- Dim currentDate As Date
- Dim result As String
- For i = 1 To Len(inputStr) Step 5
- currentTime = Mid(inputStr, i, 5)
- timeList.Add currentTime
- Next i
- If timeList.Count = 0 Then
- ston = ""
- Exit Function
- End If
- result = timeList(1)
- prevTime = CDate(timeList(1))
- For i = 2 To timeList.Count
- currentDate = CDate(timeList(i))
- If DateDiff("n", prevTime, currentDate) > 5 Then
- result = result & Chr(10) & timeList(i)
- prevTime = currentDate
- End If
- Next i
- ston = result
- End Function
复制代码
|
评分
-
2
查看全部评分
-
|