|
- Sub test2()
- Dim r%, i%
- Dim arr, brr
- Dim reg As New RegExp
- With reg
- .Global = True
- .Pattern = "^\d+.+$"
- End With
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:a" & r)
- ReDim brr(1 To UBound(arr), 1 To 2)
- m = 0
- For i = 1 To UBound(arr)
- If reg.test(arr(i, 1)) Then
- m = m + 1
- brr(m, 1) = arr(i, 1)
- Else
- brr(m, 2) = brr(m, 2) & Space(1) & arr(i, 1)
- End If
- Next
- End With
- With Worksheets("sheet3")
- .Select
- .Range("a1").Resize(UBound(brr), UBound(brr, 2)) = brr
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|