Sub 按钮1_Click()
Columns("d:d").ClearContents
Dim arr, k0, brr(), crr(), drr(), frr()
k0 = [b5].End(4).Row - 4
ReDim brr(1 To k0, 1 To 4)
ReDim crr(0 To 2), drr(0 To 2)
ReDim frr(1 To k0, 1 To 1)
arr = [b5].Resize(k0, 1)
For i = 1 To k0
k1 = 0: crr(0) = 0: crr(1) = 0: crr(2) = 0
For j = i To 1 Step -1
t1 = Left(arr(j, 1), 1): crr(t1) = crr(t1) + 1: If crr(t1) = 1 Then k1 = k1 + 1
If k1 = 2 Then brr(i, 1) = j: Exit For
Next
k2 = 0: drr(0) = 0: drr(1) = 0: drr(2) = 0
For j = i To 1 Step -1
t2 = Right(arr(j, 1), 1): drr(t2) = drr(t2) + 1: If drr(t2) = 1 Then k2 = k2 + 1
If k2 = 2 Then brr(i, 2) = j: Exit For
Next
If brr(i, 1) <> "" Or brr(i, 2) <> "" Then
brr(i, 3) = 3 - Left(arr(i, 1), 1) - Left(arr(brr(i, 1), 1), 1)
brr(i, 4) = 3 - Right(arr(i, 1), 1) - Right(arr(brr(i, 2), 1), 1)
End If
frr(i, 1) = "'" & brr(i, 3) & brr(i, 4)
Next
[d5].Resize(k0, 1) = frr
End Sub
冷码分析.zip
(725.69 KB, 下载次数: 4)
|