Option Explicit
Sub TEST()
Dim Brr, Crr, i&, Q$, X$, T$, P$, Jm%, j%, Y$
Brr = Range([A2], Cells(Rows.Count, "A").End(3))
ReDim Crr(1 To UBound(Brr), 1 To 2)
For i = 1 To UBound(Brr)
Q = Trim(Brr(i, 1))
For j = 1 To Len(Q)
T = Mid(Q, j, 1)
If T <> Evaluate("LeftB(""" & T & """,1)") Then Jm = Jm + 1: P = P & T
Next
P = Switch(Jm > 0, P, Q Like "[A-Z]*######GP##", Right(Q, 10), P = P, "")
Y = IIf(P = "", "無", P): P = Replace(Q, P, "")
X = IIf(P = "", "無", P): Crr(i, 1) = X: Crr(i, 2) = Y
P = "": Jm = 0
Next
Intersect(ActiveSheet.UsedRange.Offset(1, 0), [X:Y]).ClearContents
[X2].Resize(UBound(Crr), 2) = Crr
Erase Brr, Crr
End Sub作者: hcm19522 時間: 2023-4-25 14:25