|
Sub 按钮1_Click()
arr = [a1].CurrentRegion
brr = [a1].Resize(UBound(arr) * 5, 3)
r = 1
With CreateObject("vbscript.regexp")
.Global = True
.Pattern = "(\d+)×.+?/"
For j = 2 To UBound(arr)
If .test(arr(j, 3)) Then
str1 = ""
sm = 0
For Each m In .Execute(arr(j, 3))
If sm + Val(m.submatches(0)) > 2 Then
If Len(str1) > 0 Then
r = r + 1
brr(r, 1) = arr(j, 1)
brr(r, 2) = arr(j, 2)
brr(r, 3) = str1
End If
str1 = m.Value
sm = Val(m.submatches(0))
For i = 2 To sm Step 2
r = r + 1
brr(r, 1) = arr(j, 1)
brr(r, 2) = arr(j, 2)
brr(r, 3) = 2 & Replace(str1, sm, "")
Next i
If sm Mod 2 <> 0 Then
str1 = 1 & Replace(str1, sm, "")
sm = 1
Else
str1 = ""
sm = 0
End If
Else
sm = sm + Val(m.submatches(0))
str1 = str1 & m.Value
End If
Next m
If Len(str1) > 0 Then
r = r + 1
brr(r, 1) = arr(j, 1)
brr(r, 2) = arr(j, 2)
brr(r, 3) = str1
End If
End If
Next j
End With
[k1].Resize(r, 3) = brr
End Sub
|
评分
-
1
查看全部评分
-
|