|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 拆分()
Dim arr, i, brr, s, m, j, x
arr = Split(Sheet1.[a1].Value, ".")
For i = LBound(arr) To UBound(arr)
strInput = arr(i)
Set objRegex = CreateObject("VBScript.RegExp")
objRegex.Pattern = "\d+"
strNumbers = objRegex.Replace(strInput, "")
strNumbers = Trim(strNumbers)
objRegex.Global = True
objRegex.Pattern = "[A-Za-z]+"
strLetters = objRegex.Replace(strInput, "")
strLetters = Trim(strLetters)
s = s & "|" & strNumbers & "|" & strLetters
Next
s = Replace(s, "||", "|")
brr = Split(Mid(s, 2), "|")
k = 6
For m = 1 To 2
For j = 1 To 10
Sheet1.Cells(k + m, j) = brr(x)
x = x + 1
Next j
Next
Set objRegex = Nothing
End Sub |
|