|
Sub qs() '2024/6/28
With Sheet1
.Range("j4:z10000").Clear
arr = Range("b4:b" & Cells(Rows.Count, 2).End(3).Row)
ReDim brr(1 To UBound(arr), 1 To 4)
brr(1, 1) = arr(1, 1)
brr(1, 4) = 1
brr(1, 3) = arr(1, 1)
m = 1
For i = 2 To UBound(arr)
If Right(arr(i, 1), 7) - Right(arr(i - 1, 1), 7) = 1 Then
brr(m, 3) = arr(i, 1)
brr(m, 2) = "—"
brr(m, 4) = brr(m, 4) + 1
Else
m = m + 1
brr(m, 1) = arr(i, 1)
brr(m, 2) = "—"
brr(m, 3) = arr(i, 1)
brr(m, 4) = 1
End If
Next
With .[j4].Resize(m, 4)
.Value = brr
.Borders.LineStyle = 1
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
End With
MsgBox "完成!"
End Sub |
|