'应该差不多
Option Explicit
Sub test()
Dim arr, i, j, m, dic
Set dic = CreateObject("scripting.dictionary")
arr = Range("a1:a" & Cells(Rows.Count, "a").End(xlUp).Row + 1)
For i = 1 To UBound(arr, 1) - 1
If InStr(arr(i, 1), "、") Then
If IsNumeric(Split(arr(i, 1), "、")(0)) Then dic(arr(i, 1)) = 1
End If
Next
For i = 1 To UBound(arr, 1) - 1
If InStr(arr(i, 1), "、") Then
If IsNumeric(Split(arr(i, 1), "、")(0)) And dic(arr(i, 1)) = 1 Then
For j = i To UBound(arr, 1) - 1
m = m + 1: arr(m, 1) = arr(j, 1)
If Len(arr(j + 1, 1)) = 0 Then Exit For
If InStr(arr(j + 1, 1), "、") Then
If IsNumeric(Split(arr(j + 1, 1), "、")(0)) Then Exit For
End If
Next
dic(arr(i, 1)) = 0: i = j
End If
End If
Next
With [b:b] ' 输出位置自己修改'
.ClearContents
If m > 0 Then .Resize(m) = arr
End With
End Sub |