Sub 按钮1_Click()
Dim ar As Variant
Dim br()
ar = Sheet1.[a1].CurrentRegion
ReDim br(1 To UBound(ar) * 20, 1 To 1)
For i = 2 To UBound(ar)
sl = Len(Trim(ar(i, 1)))
If sl = 11 Then
n = n + 1
br(n, 1) = ar(i, 1)
End If
If Trim(ar(i, 2)) <> "" Then
ar(i, 2) = Replace(ar(i, 2), " ", "")
If InStr(ar(i, 2), ";") = 0 Then
sl = Val(Left(Trim(ar(i, 2)), 1))
If sl = 1 Then
n = n + 1
br(n, 1) = ar(i, 2)
End If
ElseIf InStr(ar(i, 2), ";") > 0 Then
rr = Split(ar(i, 2), ";")
For s = 0 To UBound(rr)
sl = Val(Left(Trim(rr(s)), 1))
If sl = 1 Then
n = n + 1
br(n, 1) = rr(s)
End If
Next s
End If
End If
Next i
With Sheet2
.[a1].CurrentRegion = Empty
.[a1].Resize(n, 1) = br
End With
MsgBox "ok!"
End Sub
|